Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default

2016-11-27 Thread Pitchumani Sivanupandi

On Saturday 26 November 2016 12:11 AM, Denis Chertykov wrote:

I'm sorry for delay.

I have a problem with the patch:
(Stripping trailing CRs from patch; use --binary to disable.)
patching file avr-arch.h
(Stripping trailing CRs from patch; use --binary to disable.)
patching file avr-devices.c
(Stripping trailing CRs from patch; use --binary to disable.)
patching file avr-mcus.def
Hunk #1 FAILED at 62.
1 out of 1 hunk FAILED -- saving rejects to file avr-mcus.def.rej
(Stripping trailing CRs from patch; use --binary to disable.)
patching file gen-avr-mmcu-specs.c
Hunk #1 succeeded at 215 (offset 5 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file specs.h
Hunk #1 succeeded at 58 (offset 1 line).
Hunk #2 succeeded at 66 (offset 1 line).


There are changes in avr-mcus.def after this patch is submitted.
Now, I have incorporated the changes and attached the resolved patch.

Regards,
Pitchumani

gcc/ChangeLog

2016-11-09  Pitchumani Sivanupandi 

* config/avr/avr-arch.h (avr_mcu_t): Add flash_size member.
* config/avr/avr-devices.c(avr_mcu_types): Add flash size info.
* config/avr/avr-mcu.def: Likewise.
* config/avr/gen-avr-mmcu-specs.c (print_mcu): Remove hard-coded 
prefix
check to find wrap-around value, instead use MCU flash size. For 8k 
flash
devices, update link_pmem_wrap spec string to add 
--pmem-wrap-around=8k.

* config/avr/specs.h: Remove link_pmem_wrap from LINK_RELAX_SPEC and
add to linker specs (LINK_SPEC) directly.
diff --git a/gcc/config/avr/avr-arch.h b/gcc/config/avr/avr-arch.h
index a740a15..e6a2d75 100644
--- a/gcc/config/avr/avr-arch.h
+++ b/gcc/config/avr/avr-arch.h
@@ -122,6 +122,9 @@ typedef struct
 
   /* Number of 64k segments in the flash.  */
   int n_flash;
+
+  /* Flash size in bytes.  */
+  int flash_size;
 } avr_mcu_t;
 
 /* AVR device specific features.
diff --git a/gcc/config/avr/avr-devices.c b/gcc/config/avr/avr-devices.c
index 7d13ba4..cef3b9a 100644
--- a/gcc/config/avr/avr-devices.c
+++ b/gcc/config/avr/avr-devices.c
@@ -111,12 +111,12 @@ avr_texinfo[] =
 const avr_mcu_t
 avr_mcu_types[] =
 {
-#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH)\
-  { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH },
+#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH, FLASH_SIZE)\
+  { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH, FLASH_SIZE },
 #include "avr-mcus.def"
 #undef AVR_MCU
 /* End of list.  */
-  { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0 }
+  { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0, 0 }
 };
 
 
diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def
index e5b4cda..4008741 100644
--- a/gcc/config/avr/avr-mcus.def
+++ b/gcc/config/avr/avr-mcus.def
@@ -62,295 +62,298 @@
N_FLASH   Number of 64 KiB flash segments, rounded up.  The default
  value for -mn-flash=.
 
+   FLASH_SIZEFlash size in bytes.
+
"avr2" must be first for the "0" default to work as intended.  */
 
 /* Classic, <= 8K.  */
-AVR_MCU ("avr2", ARCH_AVR2, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 6)
-AVR_MCU ("at90s2313",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2313__", 0x0060, 0x0, 1)
-AVR_MCU ("at90s2323",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2323__", 0x0060, 0x0, 1)
-AVR_MCU ("at90s2333",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2333__", 0x0060, 0x0, 1)
-AVR_MCU ("at90s2343",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2343__", 0x0060, 0x0, 1)
-AVR_MCU ("attiny22", ARCH_AVR2, AVR_SHORT_SP, "__AVR_ATtiny22__",  0x0060, 0x0, 1)
-AVR_MCU ("attiny26", ARCH_AVR2, AVR_SHORT_SP, "__AVR_ATtiny26__",  0x0060, 0x0, 1)
-AVR_MCU ("at90s4414",ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S4414__", 0x0060, 0x0, 1)
-AVR_MCU ("at90s4433",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S4433__", 0x0060, 0x0, 1)
-AVR_MCU ("at90s4434",ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S4434__", 0x0060, 0x0, 1)
-AVR_MCU ("at90s8515",ARCH_AVR2, AVR_ERRATA_SKIP, "__AVR_AT90S8515__",  0x0060, 0x0, 1)
-AVR_MCU ("at90c8534",ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90C8534__", 0x0060, 0x0, 1)
-AVR_MCU ("at90s8535",ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S8535__", 0x0060, 0x0, 1)
+AVR_MCU ("avr2", ARCH_AVR2, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 6, 0x2000)
+
+AVR_MCU ("at90s2313",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2313__", 0x0060, 0x0, 1, 0x800)
+AVR_MCU ("at90s2323",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2323__", 0x0060, 0x0, 1, 0x800)
+AVR_MCU ("at90s2333",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2333__", 0x0060, 0x0, 1, 0x800)
+AVR_MCU ("at90s2343",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2343__", 0x0060, 0x0, 1, 0x800)
+AVR_MCU ("attiny22", 

New Spanish PO file for 'gcc' (version 6.2.0)

2016-11-27 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Spanish team of translators.  The file is available at:

http://translationproject.org/latest/gcc/es.po

(This file, 'gcc-6.2.0.es.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Re: [PR78365] ICE in determine_value_range, at tree-ssa-loo p-niter.c:413

2016-11-27 Thread Prathamesh Kulkarni
On 28 November 2016 at 10:55, kugan  wrote:
> Hi,
>
> On 24/11/16 19:48, Richard Biener wrote:
>>
>> On Wed, Nov 23, 2016 at 4:33 PM, Martin Jambor  wrote:
>>>
>>> Hi,
>>>
>>> On Fri, Nov 18, 2016 at 12:38:18PM +1100, kugan wrote:

 Hi,

 I was relying on ipa_get_callee_param_type to get type of parameter and
 then
 convert arguments to this type while computing jump functions. However,
 in
 cases like shown in PR78365, ipa_get_callee_param_type, instead of
 giving
 up, would return the wrong type.
>>>
>>>
>>> At what stage does this happen?  During analysis
>>> (ipa_compute_jump_functions_for_edge) or at WPA
>>> (propagate_constants_accross_call)?  Both?
>>
>>
>> Hmm, where does jump function compute require the callee type?
>> In my view the jump function should record
>>
>>  (expected-incoming-type) arg [OP X]
>>
>> for each call argument in its body.  Thus required conversions are
>> done at WPA propagation time.
>>
 I think the current uses of
 ipa_get_callee_param_type are fine with this.

 Attached patch now uses callee's DECL_ARGUMENTS to get the type. If it
 cannot be found, then I would give up and set the jump function to
 varying.
>>>
>>>
>>> But DECL_ARGUMENTS is not available at WPA stage with LTO so your
>>> patch would make our IPA layer to optimize less with LTO.  This was
>>> the reason to go through the hoops of TYPE_ARG_TYPES in the first
>>> place.
>>>
>>> If TYPE_ARG_TYPES cannot be trusted, then I'm afraid we are back to
>>> square one and indeed need to put the correct type in jump functions.
>>
>>
>> If DECL_ARGUMENTS is not available at WPA stage then I see no other
>> way than to put the types on the jump functions.
>
>
> Here is a patch that does this. To fox PR78365, in
> ipa_get_callee_param_type, I am now checking DECL_ARGUMENTS first. I lto
> bootstrapped and regression tested on x86_64-linux-gnu and ppc64le-linux
> with no new regressions. I will build Firefox and measure the memory usage
> as Honza suggested based on the feedback.
Hi Kugan,
In your patch in ipa_get_callee_param_type():
+ tree t = e->callee ? DECL_ARGUMENTS (e->callee->decl) : NULL_TREE;

Perhaps this should be e->callee->function_symbol() ?

Thanks,
Prathamesh
>
> Thanks,
> Kugan
>
>
>
> gcc/ChangeLog:
>
> 2016-11-28  Kugan Vivekanandarajah  
>
> PR IPA/78365
> * ipa-cp.c (propagate_vr_accross_jump_function): Remove param_type
> argument and
> use the one set in jump_func.
> (propagate_constants_accross_call): Likewise.
> * ipa-prop.c (ipa_get_callee_param_type): Chedk DECL_ARGUMENTS
> first.
> (ipa_compute_jump_functions_for_edge): Set param_type for jump_func.
> (ipa_write_jump_function): Stream param_type.
> (ipa_read_jump_function): Likewise.
>
> gcc/testsuite/ChangeLog:
>
> 2016-11-28  Kugan Vivekanandarajah  
>
>
> PR IPA/78365
> * gcc.dg/torture/pr78365.c: New test.
>
>
>
>>> If just preferring DECL_ARGUMENTS is enough, then changing
>>> ipa_get_callee_param_type to use that if is is available, as Richi
>>> suggested, would indeed be preferable.  But if even falling back on it
>>> can cause errors, then I am not sure if it helps.
>>>
>>> In any event, thanks for diligently dealing with the fallout,
>>>
>>> Martin
>>>
>>>

 Bootstrapped and regression tested on x86_64-linux-gnu with no new
 regressions. Is this OK for trunk?

 Thanks,
 Kugan

 gcc/testsuite/ChangeLog:

 2016-11-18  Kugan Vivekanandarajah  

   PR IPA/78365
   * gcc.dg/torture/pr78365.c: New test.

 gcc/ChangeLog:

 2016-11-18  Kugan Vivekanandarajah  

   PR IPA/78365
   * ipa-cp.c (propagate_constants_accross_call): get param type from
 callees
   DECL_ARGUMENTS if available.
   * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise.
   (ipcp_update_vr):  Remove now redundant conversion of precision
 for VR.
   * ipa-prop.h: Make ipa_get_callee_param_type local again.


Re: [PR78365] ICE in determine_value_range, at tree-ssa-loo p-niter.c:413

2016-11-27 Thread kugan

Hi,

On 24/11/16 19:48, Richard Biener wrote:

On Wed, Nov 23, 2016 at 4:33 PM, Martin Jambor  wrote:

Hi,

On Fri, Nov 18, 2016 at 12:38:18PM +1100, kugan wrote:

Hi,

I was relying on ipa_get_callee_param_type to get type of parameter and then
convert arguments to this type while computing jump functions. However, in
cases like shown in PR78365, ipa_get_callee_param_type, instead of giving
up, would return the wrong type.


At what stage does this happen?  During analysis
(ipa_compute_jump_functions_for_edge) or at WPA
(propagate_constants_accross_call)?  Both?


Hmm, where does jump function compute require the callee type?
In my view the jump function should record

 (expected-incoming-type) arg [OP X]

for each call argument in its body.  Thus required conversions are
done at WPA propagation time.


I think the current uses of
ipa_get_callee_param_type are fine with this.

Attached patch now uses callee's DECL_ARGUMENTS to get the type. If it
cannot be found, then I would give up and set the jump function to varying.


But DECL_ARGUMENTS is not available at WPA stage with LTO so your
patch would make our IPA layer to optimize less with LTO.  This was
the reason to go through the hoops of TYPE_ARG_TYPES in the first
place.

If TYPE_ARG_TYPES cannot be trusted, then I'm afraid we are back to
square one and indeed need to put the correct type in jump functions.


If DECL_ARGUMENTS is not available at WPA stage then I see no other
way than to put the types on the jump functions.


Here is a patch that does this. To fox PR78365, in 
ipa_get_callee_param_type, I am now checking DECL_ARGUMENTS first. I lto 
bootstrapped and regression tested on x86_64-linux-gnu and ppc64le-linux 
with no new regressions. I will build Firefox and measure the memory 
usage as Honza suggested based on the feedback.


Thanks,
Kugan



gcc/ChangeLog:

2016-11-28  Kugan Vivekanandarajah  

PR IPA/78365
	* ipa-cp.c (propagate_vr_accross_jump_function): Remove param_type 
argument and

use the one set in jump_func.
(propagate_constants_accross_call): Likewise.
* ipa-prop.c (ipa_get_callee_param_type): Chedk DECL_ARGUMENTS first.
(ipa_compute_jump_functions_for_edge): Set param_type for jump_func.
(ipa_write_jump_function): Stream param_type.
(ipa_read_jump_function): Likewise.

gcc/testsuite/ChangeLog:

2016-11-28  Kugan Vivekanandarajah  

PR IPA/78365
* gcc.dg/torture/pr78365.c: New test.




If just preferring DECL_ARGUMENTS is enough, then changing
ipa_get_callee_param_type to use that if is is available, as Richi
suggested, would indeed be preferable.  But if even falling back on it
can cause errors, then I am not sure if it helps.

In any event, thanks for diligently dealing with the fallout,

Martin




Bootstrapped and regression tested on x86_64-linux-gnu with no new
regressions. Is this OK for trunk?

Thanks,
Kugan

gcc/testsuite/ChangeLog:

2016-11-18  Kugan Vivekanandarajah  

  PR IPA/78365
  * gcc.dg/torture/pr78365.c: New test.

gcc/ChangeLog:

2016-11-18  Kugan Vivekanandarajah  

  PR IPA/78365
  * ipa-cp.c (propagate_constants_accross_call): get param type from callees
  DECL_ARGUMENTS if available.
  * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise.
  (ipcp_update_vr):  Remove now redundant conversion of precision for VR.
  * ipa-prop.h: Make ipa_get_callee_param_type local again.
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 2ec671f..3d50041 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -1846,11 +1846,11 @@ propagate_bits_accross_jump_function (cgraph_edge *cs, 
int idx, ipa_jump_func *j
 static bool
 propagate_vr_accross_jump_function (cgraph_edge *cs,
ipa_jump_func *jfunc,
-   struct ipcp_param_lattices *dest_plats,
-   tree param_type)
+   struct ipcp_param_lattices *dest_plats)
 {
   struct ipcp_param_lattices *src_lats;
   ipcp_vr_lattice *dest_lat = _plats->m_value_range;
+  tree param_type = jfunc->param_type;
 
   if (dest_lat->bottom_p ())
 return false;
@@ -1895,9 +1895,9 @@ propagate_vr_accross_jump_function (cgraph_edge *cs,
   tree val = ipa_get_jf_constant (jfunc);
   if (TREE_CODE (val) == INTEGER_CST)
{
+ val = fold_convert (param_type, val);
  if (TREE_OVERFLOW_P (val))
val = drop_tree_overflow (val);
- val = fold_convert (param_type, val);
  jfunc->vr_known = true;
  jfunc->m_vr.type = VR_RANGE;
  jfunc->m_vr.min = val;
@@ -2247,7 +2247,6 @@ propagate_constants_accross_call (struct cgraph_edge *cs)
 {
   struct ipa_jump_func *jump_func = ipa_get_ith_jump_func (args, i);
   struct ipcp_param_lattices *dest_plats;
-  tree param_type 

C++ PATCH for c++/77907 (constant init and PMF)

2016-11-27 Thread Jason Merrill
When evaluating a NOP_EXPR of a PTRMEM_CST, we should fold it into the
PTRMEM_CST rather than wrap it.

Tested x86_64-pc-linux-gnu, applying to trunk and 6.
commit fa9d4e0435f71a0a335ecc00af23b1cfe568de3c
Author: Jason Merrill 
Date:   Wed Nov 23 17:15:29 2016 -0500

PR c++/77907 - static init and PMF

* constexpr.c (cxx_eval_constant_expression): Use cp_fold_convert.

diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 40d1e7b..f93dd47 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -4226,7 +4226,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, 
tree t,
  {
if (same_type_ignoring_top_level_qualifiers_p (type,
   TREE_TYPE (op)))
- STRIP_NOPS (t);
+ return cp_fold_convert (type, op);
else
  {
if (!ctx->quiet)
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77907.C 
b/gcc/testsuite/g++.dg/cpp0x/pr77907.C
index d46c707..8128e8c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr77907.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr77907.C
@@ -1,6 +1,7 @@
 // PR c++/77907
 // { dg-do run { target c++11 } }
-// { dg-options "-O2" }
+// { dg-options "-O2 -save-temps" }
+// { dg-final { scan-assembler-not "static_initialization" } }
 
 struct A {
   int foo () { return 1; }


[PATCH] correct handling of non-constant width and precision (pr 78521)

2016-11-27 Thread Martin Sebor

PR 78521 notes that the gimple-ssa-sprintf pass doesn't do the right
thing (i.e., the -Wformat-length and -fprintf-return-value options
behave incorrectly) when a conversion specification includes a width
or precision with a non-constant value.  The code treats such cases
as if they were not provided which is incorrect and results in
the wrong bytes counts in warning messages and in the wrong ranges
being generated for such calls (or in the case sprintf(0, 0, ...)
for some such calls being eliminated).

The attached patch corrects the handling of these cases, plus a couple
of other edge cases in the same area: it adjusts the parser to accept
precision in the form of just a period with no asterisk or decimal
digits after it (this sets the precision to zero), and corrects the
handling of zero precision and zero argument in integer directives
to produce no bytes on output.

Finally, the patch also tightens up the constraint on the upper bound
of bounded functions like snprintf to be INT_MAX.  The functions cannot
produce output in excess of INT_MAX + 1 bytes and some implementations
(e.g., Solaris) fail with EINVAL when the bound is INT_MAX or more.
This is the subject of PR 78520.

Thanks
Martin
PR middle-end/78521 - [7 Regression] incorrect byte count in -Wformat-length warning with non-constant width or precision
PR middle-end/78520 - missing warning for snprintf with size greater than INT_MAX
gcc/ChangeLog:

	PR middle-end/78521
	PR middle-end/78520
	* gimple-ssa-sprintf.c (target_max_value): Remove.
	(target_int_max, target_size_max): Use TYPE_MAX_VALUE.
	(get_width_and_precision): New function.
	(format_integer, format_floating, get_string_length, format_string):
	Correct handling of width and precision with unknown value.
	(format_directive): Add warning.
	(pass_sprintf_length::compute_format_length): Allow for precision
	to consist of a sole period with no asterisk or digits after it.

gcc/testsuite/ChangeLog:

	PR middle-end/78521
	PR middle-end/78520
	* gcc.dg/tree-ssa/builtin-sprintf-5.c: Add test cases.
	* gcc.dg/tree-ssa/builtin-sprintf-6.c: New test.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Add test cases.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Add test cases.

diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index dc2b66d..9f07503 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -235,23 +235,12 @@ target_int_min ()
   return int_min;
 }
 
-/* Return the largest value for TYPE on the target.  */
-
-static unsigned HOST_WIDE_INT
-target_max_value (tree type)
-{
-  const unsigned HOST_WIDE_INT max_value
-= HOST_WIDE_INT_M1U >> (HOST_BITS_PER_WIDE_INT
-			- TYPE_PRECISION (type) + 1);
-  return max_value;
-}
-
 /* Return the value of INT_MAX for the target.  */
 
 static inline unsigned HOST_WIDE_INT
 target_int_max ()
 {
-  return target_max_value (integer_type_node);
+  return tree_to_uhwi (TYPE_MAX_VALUE (integer_type_node));
 }
 
 /* Return the value of SIZE_MAX for the target.  */
@@ -259,7 +248,7 @@ target_int_max ()
 static inline unsigned HOST_WIDE_INT
 target_size_max ()
 {
-  return target_max_value (size_type_node);
+  return tree_to_uhwi (TYPE_MAX_VALUE (size_type_node));
 }
 
 /* Return the constant initial value of DECL if available or DECL
@@ -843,6 +832,43 @@ format_pointer (const conversion_spec , tree arg)
   return res;
 }
 
+/* Set *PWIDTH and *PPREC according to the width and precision specified
+   in SPEC.  Each is set to HOST_WIDE_INT_MIN when the corresponding
+   field is specified but unknown, to zero for width and -1, respectively
+   when it's not specified, or to a non-negative value corresponding to
+   the known value.  */
+static void
+get_width_and_precision (const conversion_spec ,
+			 HOST_WIDE_INT *pwidth, HOST_WIDE_INT *pprec)
+{
+  HOST_WIDE_INT width = spec.have_width ? spec.width : 0;
+  HOST_WIDE_INT prec = spec.have_precision ? spec.precision : -1;
+
+  if (spec.star_width)
+{
+  if (TREE_CODE (spec.star_width) == INTEGER_CST)
+	width = abs (tree_to_shwi (spec.star_width));
+  else
+	width = HOST_WIDE_INT_MIN;
+}
+
+  if (spec.star_precision)
+{
+  if (TREE_CODE (spec.star_precision) == INTEGER_CST)
+	{
+	  prec = tree_to_shwi (spec.star_precision);
+	  if (prec < 0)
+	prec = 0;
+	}
+  else
+	prec = HOST_WIDE_INT_MIN;
+}
+
+  *pwidth = width;
+  *pprec = prec;
+}
+
+
 /* Return a range representing the minimum and maximum number of bytes
that the conversion specification SPEC will write on output for the
integer argument ARG when non-null.  ARG may be null (for vararg
@@ -860,18 +886,10 @@ format_integer (const conversion_spec , tree arg)
   if (!intmax_type_node)
 build_intmax_type_nodes (_type_node, _type_node);
 
-  /* Set WIDTH and PRECISION to either the values in the format
- specification or to zero.  */
-  int width = spec.have_width ? spec.width : 0;
-  int prec = spec.have_precision ? spec.precision : 0;
-
-  if (spec.star_width)
-

[PATCH] remove invalid "tail +16c"

2016-11-27 Thread ma . jiang
Hi all,
  In "config/acx.m4", there are still some "tail +16c"  which are invalid 
on POSIX systems. 
  In my opinion, all "tail +16c" should be changed to "tail -c +16" 
directly, as most systems has accept the latter.
  And, to skip first 16 bytes, we should use "tail -c +17" instead of 
"tail -c +16".

 * config/acx.m4:Change "tail +16c" to "tail -c +17".
 * configure: Regenerate.
--- gcc-6.2.0/config/acx.m4 2011-12-18 17:58:37.0 +0800
+++ gcc-6.2.0-bak/config/acx.m4 2016-11-23 10:56:21.065817691 +0800
@@ -404,7 +404,7 @@ AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL],
 [AC_CACHE_CHECK([how to compare bootstrapped objects], 
gcc_cv_prog_cmp_skip,
 [ echo abfoo >t1
   echo cdfoo >t2
-  gcc_cv_prog_cmp_skip='tail +16c $$f1 > tmp-foo1; tail +16c $$f2 > 
tmp-foo2; cmp tmp-foo1 tmp-foo2'
+  gcc_cv_prog_cmp_skip='tail -c +17 $$f1 > tmp-foo1; tail -c +17 $$f2 > 
tmp-foo2; cmp tmp-foo1 tmp-foo2'
   if cmp t1 t2 2 2 > /dev/null 2>&1; then
 if cmp t1 t2 1 1 > /dev/null 2>&1; then
   :


[Ada] Fix PR ada/78524

2016-11-27 Thread Eric Botcazou
This is the failure of ACATS c41104a introduced by the recent match.pd change.

Fixed thusly, tested on x86_64-suse-linux, applied on the mainline.


2016-11-27  Eric Botcazou  

PR ada/78524
* gcc-interface/utils.c (max_size) : Add missing
conversion to original type in the PLACEHOLDER_EXPR case.

-- 
Eric BotcazouIndex: gcc-interface/utils.c
===
--- gcc-interface/utils.c	(revision 242863)
+++ gcc-interface/utils.c	(working copy)
@@ -3548,7 +3548,9 @@ max_size (tree exp, bool max_p)
 	{
 	  tree val_type = TREE_TYPE (TREE_OPERAND (exp, 1));
 	  tree val = (max_p ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type));
-	  return max_size (convert (get_base_type (val_type), val), true);
+	  return
+	convert (type,
+		 max_size (convert (get_base_type (val_type), val), true));
 	}
 
   return exp;


Re: [PATCH] Fix a couple of issues in gimple-ssa-sprintf.c

2016-11-27 Thread Jakub Jelinek
On Sat, Nov 26, 2016 at 11:17:09AM -0700, Martin Sebor wrote:
> PS As the comment above the build_intmax_type_node function
> mentions, its body was copied from lto/lto-lang.c.  It would be
> useful not to have to duplicate the code in the middle-end and
> instead provide a shared definition of each of the nodes so that
> they could be used everywhere.  Ditto for ptrdiff_type_node.

Well, every unnecessary or very rarely used global tree means typically
another GC root or global variable that needs to be handled on every garbage
collection.  So the question is if it is worth it.

As for sharing the code, I've actually started writing such an inline
function, but then realized that every of the spots that use such a
technique does something slightly different.

Jakub


Re: [patch, libfortran] Add AVX-specific matmul

2016-11-27 Thread Jerry DeLisle

On 11/27/2016 08:50 AM, Thomas Koenig wrote:

Hello world,

here is another, much revised, update of the AVX-specific matmul patch.

The processor-specific switching is now done directly, using the


--- snip ---

This comment not right:

+/* Put exhaustive list of possible architectures here here, ORed together.  */

Performs as expected on my AMD machines. We can still improve peak performance 
on these by about 7%. To clarify, these chips require -mavx -mprefer-avx128. So 
what we need to do is sort out which AMD CPUs need this adjustment with AVX 
registers. (A later patch)


I would like to suggest that rather than matmul_internal.m4 to maybe name this 
file matmul_base.m4, but not critical.


Need a libgcc person for the changes to the cpuinfo items.

The libgfortran portions look OK.

Jerry



[Ada] Fix PR ada/78531

2016-11-27 Thread Eric Botcazou
This is the bootstrap failure on the mainline with _FORTIFY_SOURCE enabled.

Fixed thusly, tested on x86_64-suse-linux, applied on the mainline.


2016-11-27  Eric Botcazou  

PR ada/78531
* namet.h (Max_Line_Length): Define.
(struct Bounded_String): Declare Chars with exact size.
(namet__get_decoded_name_string): Delete.
(Get_Decoded_Name_String): Likewise.
(casing__set_all_upper_case): Likewise.

-- 
Eric BotcazouIndex: namet.h
===
--- namet.h	(revision 242863)
+++ namet.h	(working copy)
@@ -6,7 +6,7 @@
  *  *
  *  C Header File   *
  *  *
- *Copyright (C) 1992-2015, Free Software Foundation, Inc.   *
+ *Copyright (C) 1992-2016, Free Software Foundation, Inc.   *
  *  *
  * GNAT is free software;  you can  redistribute it  and/or modify it under *
  * terms of the  GNU General Public License as published  by the Free Soft- *
@@ -25,7 +25,7 @@
 
 /* This is the C file that corresponds to the Ada package specification
Namet.  It was created manually from files namet.ads and namet.adb.
-   Some subprograms from Sinput are also made accessible here.  */
+   Subprograms from Exp_Dbug and Sinput are also made accessible here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,14 +52,15 @@ extern struct Name_Entry *Names_Ptr;
 #define Name_Chars_Ptr namet__name_chars__table
 extern char *Name_Chars_Ptr;
 
-/* The global name buffer. */
+/* This is Hostparm.Max_Line_Length.  */
+#define Max_Line_Length (32767 - 1)
+
+/* The global name buffer.  */
 struct Bounded_String
 {
   Nat Max_Length;
   Nat Length;
-  char Chars[1];
-  /* The 1 here is wrong, but it doesn't matter, because all the code either
- goes by Length, or NUL-terminates the string before processing it. */
+  char Chars[4 * Max_Line_Length]; /* Exact value for overflow detection.  */
 };
 
 #define Global_Name_Buffer namet__global_name_buffer
@@ -81,32 +82,9 @@ Get_Name_String (Name_Id Id)
   return Name_Chars_Ptr + Names_Ptr[Id - First_Name_Id].Name_Chars_Index + 1;
 }
 
-/* Get_Decoded_Name_String returns a null terminated C string in the same
-   manner as Get_Name_String, except that it is decoded (i.e. upper half or
-   wide characters are put back in their external form, and character literals
-   are also returned in their external form (with surrounding apostrophes) */
-
-extern void namet__get_decoded_name_string (Name_Id);
-
-static char *Get_Decoded_Name_String (Name_Id);
-
-INLINE char *
-Get_Decoded_Name_String (Name_Id Id)
-{
-  namet__get_decoded_name_string (Id);
-  Name_Buffer[Name_Len] = 0;
-  return Name_Buffer;
-}
-
 #define Name_Equals namet__name_equals
 extern Boolean Name_Equals (Name_Id, Name_Id);
 
-/* Like Get_Decoded_Name_String, but the result has all qualification and
-   package body entity suffixes stripped, and also all letters are upper
-   cased.  This is used for building the enumeration literal table. */
-
-extern void casing__set_all_upper_case (void);
-
 /* The following routines and variables are not part of Namet, but we
include the header here since it seems the best place for it.  */
 


ping x2: Re: [PATCH] shrink-wrap: New spread_components

2016-11-27 Thread Segher Boessenkool
Ping.

On Sat, Nov 19, 2016 at 11:24:34AM -0600, Segher Boessenkool wrote:
> Ping.
> 
> On Wed, Nov 09, 2016 at 09:46:55PM +, Segher Boessenkool wrote:
> > This patch changes spread_components to use a simpler algorithm that
> > puts prologue components as early as possible, and epilogue components
> > as late as possible.  This allows better scheduling, and also saves a
> > bit of code size.  The blocks that run with some specific component
> > enabled after this patch is a strict superset of those that had it
> > before the patch.
> > 
> > It does this by finding for every component the basic blocks where that
> > component is not needed on some path from the entry block (it reuses
> > head_components to store this), and similarly the blocks where the
> > component is not needed on some path to the exit block (or the exit can
> > not be reached from that block) (stored in tail_components).  Blocks
> > that then are in neither of those two sets get the component active.
> > 
> > Tested on powerpc64-linux {-m32,-m64}.  Is this okay for trunk?
> > 
> > 
> > Segher
> > 
> > 
> > 2016-11-09  Segher Boessenkool  
> > 
> > * shrink-wrap.c (init_separate_shrink_wrap): Do not clear
> > head_components and tail_components.
> > (spread_components): New algorithm.
> > (emit_common_tails_for_components): Clear head_components and
> > tail_components.
> > (insert_prologue_epilogue_for_components): Write extra output to the
> > dump file for sibcalls and abnormal exits.
> > 
> > ---
> >  gcc/shrink-wrap.c | 181 
> > +++---
> >  1 file changed, 146 insertions(+), 35 deletions(-)
> > 
> > diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
> > index 4395d8a..e480d4d 100644
> > --- a/gcc/shrink-wrap.c
> > +++ b/gcc/shrink-wrap.c
> > @@ -1131,8 +1131,6 @@ init_separate_shrink_wrap (sbitmap components)
> >SW (bb)->head_components = sbitmap_alloc (SBITMAP_SIZE (components));
> >SW (bb)->tail_components = sbitmap_alloc (SBITMAP_SIZE (components));
> >bitmap_clear (SW (bb)->has_components);
> > -  bitmap_clear (SW (bb)->head_components);
> > -  bitmap_clear (SW (bb)->tail_components);
> >  }
> >  }
> >  
> > @@ -1253,48 +1251,151 @@ place_prologue_for_one_component (unsigned int 
> > which, basic_block head)
> >  }
> >  }
> >  
> > -/* Mark HAS_COMPONENTS for every block dominated by at least one block with
> > -   HAS_COMPONENTS set for the respective components, starting at HEAD.  */
> > +/* Set HAS_COMPONENTS in every block to the maximum it can be set to 
> > without
> > +   setting it on any path from entry to exit where it was not already set
> > +   somewhere (or, for blocks that have no path to the exit, consider only
> > +   paths from the entry to the block itself).  */
> >  static void
> > -spread_components (basic_block head)
> > +spread_components (sbitmap components)
> >  {
> > -  basic_block bb = head;
> > -  bool first_visit = true;
> > -  /* This keeps a tally of all components active.  */
> > -  sbitmap components = SW (head)->has_components;
> > +  basic_block entry_block = ENTRY_BLOCK_PTR_FOR_FN (cfun);
> > +  basic_block exit_block = EXIT_BLOCK_PTR_FOR_FN (cfun);
> >  
> > -  for (;;)
> > +  /* A stack of all blocks left to consider, and a bitmap of all blocks
> > + on that stack.  */
> > +  vec todo;
> > +  todo.create (n_basic_blocks_for_fn (cfun));
> > +  bitmap seen = BITMAP_ALLOC (NULL);
> > +
> > +  sbitmap old = sbitmap_alloc (SBITMAP_SIZE (components));
> > +
> > +  /* Find for every block the components that are *not* needed on some path
> > + from the entry to that block.  Do this with a flood fill from the 
> > entry
> > + block.  Every block can be visited at most as often as the number of
> > + components (plus one), and usually much less often.  */
> > +
> > +  if (dump_file)
> > +fprintf (dump_file, "Spreading down...\n");
> > +
> > +  basic_block bb;
> > +  FOR_ALL_BB_FN (bb, cfun)
> > +bitmap_clear (SW (bb)->head_components);
> > +
> > +  bitmap_copy (SW (entry_block)->head_components, components);
> > +
> > +  edge e;
> > +  edge_iterator ei;
> > +
> > +  todo.quick_push (single_succ (entry_block));
> > +  bitmap_set_bit (seen, single_succ (entry_block)->index);
> > +  while (!todo.is_empty ())
> >  {
> > -  if (first_visit)
> > -   {
> > - bitmap_ior (SW (bb)->has_components, SW (bb)->has_components,
> > - components);
> > +  bb = todo.pop ();
> >  
> > - if (first_dom_son (CDI_DOMINATORS, bb))
> > -   {
> > - components = SW (bb)->has_components;
> > - bb = first_dom_son (CDI_DOMINATORS, bb);
> > - continue;
> > -   }
> > -   }
> > +  bitmap_copy (old, SW (bb)->head_components);
> >  
> > -  components = SW (bb)->has_components;
> > +  FOR_EACH_EDGE (e, ei, bb->preds)
> > +   bitmap_ior (SW (bb)->head_components, SW (bb)->head_components,

Re: [Patch, fortran] PR78474 - gfortran accepts invalid submodule syntax

2016-11-27 Thread Paul Richard Thomas
Hi Steve,

Committed as revision 242900 together with a similarly trivial fix for
PR78331. I would have submitted the latter separately but found myself
timing out before I have to travel.

Both will be added to 6-branch in a week's time.

Thanks

Paul

On 27 November 2016 at 19:09, Steve Kargl
 wrote:
> On Sun, Nov 27, 2016 at 06:42:12PM +0100, Paul Richard Thomas wrote:
>>
>> This is a rather trivial problem with a similarly trivial fix. The
>> ChangeLog says it all.
>>
>> Before anybody asks, the testcase number jumps by two because I am
>> going through the submodule PRs in reverse order.
>>
>> Bootstraps and regtests on FC21/x86_64 - OK for trunk and 6-branch?
>>
>
> Yes.
>
> --
> Steve



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein


Re: [v3 PATCH] Implement LWG 2534, Constrain rvalue stream operators.

2016-11-27 Thread Ville Voutilainen
On 27 November 2016 at 20:50, Ville Voutilainen
 wrote:
> * include/std/ostream /__is_convertible_to_basic_ostream): New.


And yeah, I have fixed that typo in my ChangeLog already, it should indeed be
* include/std/ostream (__is_convertible_to_basic_ostream): New.


[v3 PATCH] Implement LWG 2534, Constrain rvalue stream operators.

2016-11-27 Thread Ville Voutilainen
Tested on Linux-x64.

2016-11-27  Ville Voutilainen  

Implement LWG 2534, Constrain rvalue stream operators.
* include/std/istream (__is_convertible_to_basic_istream): New.
(__is_extractable): Likewise.
(operator>>(basic_istream<_CharT, _Traits>&&, _Tp&&)):
Turn the stream parameter into a template parameter
and constrain.
* include/std/ostream /__is_convertible_to_basic_ostream): New.
(__is_insertable): Likewise.
(operator<<(basic_ostream<_CharT, _Traits>&&, const _Tp&)):
Turn the stream parameter into a template parameter
and constrain.
* testsuite/27_io/basic_istream/extractors_other/char/4.cc: New.
* testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/6.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc: Likewise.
diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index c8a2e08..4f0e940 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -908,6 +908,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 ws(basic_istream<_CharT, _Traits>& __is);
 
 #if __cplusplus >= 201103L
+
+  template
+struct __is_convertible_to_basic_istream
+{
+  template
+  static true_type __check(basic_istream<_Ch, _Up>*);
+
+  static false_type __check(void*);
+public:
+  using type = decltype(__check(declval<_Tp*>()));
+  constexpr static bool value = type::value;
+  };
+
+  template
+struct __is_extractable : false_type {};
+
+  template
+struct __is_extractable<_Istream, _Tp,
+   __void_t()
+ >> declval<_Tp>())>>
+: true_type {};
+
   // [27.7.1.6] Rvalue stream extraction
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // 2328. Rvalue stream extraction should use perfect forwarding
@@ -921,9 +943,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*  rvalue streams since they won't bind to the extractor functions
*  that take an lvalue reference.
   */
-  template
-inline basic_istream<_CharT, _Traits>&
-operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x)
+  template
+inline
+typename enable_if<__and_<__not_>,
+ __is_convertible_to_basic_istream<
+   typename remove_reference<_Istream>::type>,
+ __is_extractable<_Istream&, _Tp&&>>::value,
+  _Istream&>::type
+operator>>(_Istream&& __is, _Tp&& __x)
 {
   __is >> std::forward<_Tp>(__x);
   return __is;
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 0bf53f0..a1fe892 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -613,6 +613,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { return __os.flush(); }
 
 #if __cplusplus >= 201103L
+  template
+struct __is_convertible_to_basic_ostream
+  {
+template
+static true_type __check(basic_ostream<_Ch, _Up>*);
+
+static false_type __check(void*);
+  public:
+using type = decltype(__check(declval<_Tp*>()));
+constexpr static bool value = type::value;
+  };
+
+  template
+struct __is_insertable : false_type {};
+
+  template
+struct __is_insertable<_Ostream, _Tp,
+  __void_t()
+<< declval())>>
+   : true_type {};
+
   /**
*  @brief  Generic inserter for rvalue stream
*  @param  __os  An input stream.
@@ -623,9 +644,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*  rvalue streams since they won't bind to the inserter functions
*  that take an lvalue reference.
   */
-  template
-inline basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
+  template
+inline
+typename enable_if<__and_<__not_>,
+ __is_convertible_to_basic_ostream<
+   typename remove_reference<_Ostream>::type>,
+ __is_insertable<_Ostream&, const _Tp&>>::value,
+  _Ostream&>::type
+ //basic_ostream<_CharT, _Traits>&
+operator<<(_Ostream&& __os, const _Tp& __x)
 {
   __os << __x;
   return __os;
diff --git 
a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/4.cc 
b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/4.cc
new file mode 100644
index 000..0922b0b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/4.cc
@@ -0,0 +1,96 @@
+// { dg-do run { target c++11 } }
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free

Re: [Patch, fortran] PR78474 - gfortran accepts invalid submodule syntax

2016-11-27 Thread Steve Kargl
On Sun, Nov 27, 2016 at 06:42:12PM +0100, Paul Richard Thomas wrote:
> 
> This is a rather trivial problem with a similarly trivial fix. The
> ChangeLog says it all.
> 
> Before anybody asks, the testcase number jumps by two because I am
> going through the submodule PRs in reverse order.
> 
> Bootstraps and regtests on FC21/x86_64 - OK for trunk and 6-branch?
> 

Yes.

-- 
Steve


[Patch, fortran] PR78474 - gfortran accepts invalid submodule syntax

2016-11-27 Thread Paul Richard Thomas
Dear All,

This is a rather trivial problem with a similarly trivial fix. The
ChangeLog says it all.

Before anybody asks, the testcase number jumps by two because I am
going through the submodule PRs in reverse order.

Bootstraps and regtests on FC21/x86_64 - OK for trunk and 6-branch?

Paul

2016-11-27  Paul Thomas  

PR fortran/78474
* module.c (gfc_match_submodule): If there is more than one
colon, it is a syntax error.

2016-11-27  Paul Thomas  

PR fortran/78474
* gfortran.dg/submodule_22.f08: New test.
Index: gcc/fortran/module.c
===
*** gcc/fortran/module.c(revision 242874)
--- gcc/fortran/module.c(working copy)
*** gfc_match_submodule (void)
*** 740,745 
--- 740,746 
match m;
char name[GFC_MAX_SYMBOL_LEN + 1];
gfc_use_list *use_list;
+   bool seen_colon = false;
  
if (!gfc_notify_std (GFC_STD_F2008, "SUBMODULE declaration at %C"))
  return MATCH_ERROR;
*** gfc_match_submodule (void)
*** 772,778 
}
else
{
!   module_list = use_list;
  use_list->module_name = gfc_get_string (name);
  use_list->submodule_name = use_list->module_name;
}
--- 773,779 
}
else
{
! module_list = use_list;
  use_list->module_name = gfc_get_string (name);
  use_list->submodule_name = use_list->module_name;
}
*** gfc_match_submodule (void)
*** 780,787 
if (gfc_match_char (')') == MATCH_YES)
break;
  
!   if (gfc_match_char (':') != MATCH_YES)
goto syntax;
  }
  
m = gfc_match (" %s%t", _new_block);
--- 781,791 
if (gfc_match_char (')') == MATCH_YES)
break;
  
!   if (gfc_match_char (':') != MATCH_YES
! || seen_colon)
goto syntax;
+ 
+   seen_colon = true;
  }
  
m = gfc_match (" %s%t", _new_block);
Index: gcc/testsuite/gfortran.dg/submodule_22.f08
===
*** gcc/testsuite/gfortran.dg/submodule_22.f08  (revision 0)
--- gcc/testsuite/gfortran.dg/submodule_22.f08  (working copy)
***
*** 0 
--- 1,47 
+ ! { dg-do compile }
+ !
+ ! Test the fix for PR78474.
+ !
+ ! Contributed by Nicholas Brearly  
+ !
+ module mtop
+   implicit none
+   real :: r
+   interface
+ module subroutine sub1()
+ end subroutine
+   end interface
+   interface
+ module subroutine sub2()
+ end subroutine
+   end interface
+   interface
+ module subroutine sub3()
+ end subroutine
+   end interface
+ end module mtop
+ 
+ submodule (mtop) submod
+   implicit none
+   real :: s
+ contains
+   module subroutine sub1
+ r = 0.0
+   end subroutine sub1
+ end
+ 
+ submodule (mtop:submod) subsubmod
+ contains
+   module subroutine sub2
+ r = 1.0
+ s = 1.0
+   end subroutine sub2
+ end
+ 
+ submodule (mtop:submod:subsubmod) subsubsubmod ! { dg-error "Syntax error in 
SUBMODULE statement" }
+ contains
+   module subroutine sub3
+ r = 2.0
+ s = 2.0
+   end subroutine sub3
+ end


Re: [Patch][i386] PR 70118: Fix ubsan warning on SSE2 loadl_epi64 and storel_epi64

2016-11-27 Thread Allan Sandfeld Jensen
On Sunday 27 November 2016, Marc Glisse wrote:
> On Sat, 26 Nov 2016, Allan Sandfeld Jensen wrote:
> > Use the recently introduced unaligned variant of __m128i and add a
> > similar __m64 and use those to make it clear these two intrinsics
> > require neither 128- bit nor 64-bit alignment.
> 
> Thanks for doing this. You'll want Uros or Kirill to review your patch.
> There are probably several more places that could do with an unaligned
> fix, but we don't have to find them all at once.
> First I found it strange to use __m64, but then it actually seems like a
> good call to use a type that is not just aligned(1) but also may_alias.
> 
> +  *(__m64_u *)__P = __m64(((__v2di)__B)[0]);
> 
> gcc complains about this syntax for me, it wants parentheses around
> __m64... Did it pass the testsuite for you?

Fixed, it now matches the move just below.
Index: gcc/config/i386/emmintrin.h
===
--- gcc/config/i386/emmintrin.h	(revision 242892)
+++ gcc/config/i386/emmintrin.h	(working copy)
@@ -703,9 +703,9 @@
 }
 
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_loadl_epi64 (__m128i const *__P)
+_mm_loadl_epi64 (__m128i_u const *__P)
 {
-  return _mm_set_epi64 ((__m64)0LL, *(__m64 *)__P);
+  return _mm_set_epi64 ((__m64)0LL, *(__m64_u *)__P);
 }
 
 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
@@ -721,9 +721,9 @@
 }
 
 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_mm_storel_epi64 (__m128i *__P, __m128i __B)
+_mm_storel_epi64 (__m128i_u *__P, __m128i __B)
 {
-  *(long long *)__P = ((__v2di)__B)[0];
+  *(__m64_u *)__P = (__m64) ((__v2di)__B)[0];
 }
 
 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
Index: gcc/config/i386/mmintrin.h
===
--- gcc/config/i386/mmintrin.h	(revision 242892)
+++ gcc/config/i386/mmintrin.h	(working copy)
@@ -37,6 +37,9 @@
vector types, and their scalar components.  */
 typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
 
+/* Unaligned version of the same type  */
+typedef int __m64_u __attribute__ ((__vector_size__ (8), __may_alias__, __aligned__ (1)));
+
 /* Internal data types for implementing the intrinsics.  */
 typedef int __v2si __attribute__ ((__vector_size__ (8)));
 typedef short __v4hi __attribute__ ((__vector_size__ (8)));


Re: Hurd port for gcc go PATCH 1-4(23)

2016-11-27 Thread Samuel Thibault
Svante Signell, on Sun 27 Nov 2016 18:17:17 +0100, wrote:
> On Sun, 2016-11-27 at 18:02 +0100, Samuel Thibault wrote:
> > > But as you wish, an updated patch is attached.
> > 
> >  _Bool
> >  Continued (uint32_t *w)
> >  {
> > +#ifndef WCONTINUED
> > +  *w = 0;
> > +  return 0;
> > +#else
> >    return WIFCONTINUED (*w) != 0;
> > +#endif
> >  }
> > 
> > Err, recheck the semantic of WCONTINUED again, it doesn't modify its
> > parameter, it just tests its value.
> > 
> > Do as I said, just return 0.
> 
> No I can't the compiler complains about an unused variable. Maybe
> adding an __attribute__((unused)) to the function header?

For instance.  See how it is done in the rest of the code.

> > > This is for upstream to decide.
> > 
> > I'm just afraid they'd just frown on the code submission and not take
> > the time to explain how they want it to look like if we don't raise
> > the
> > discussion ourselves.
> > 
> 
> Should we propose these changes upstream? Or do you mean something
> else? 

I mean proposing explicitly to upstream, yes, so they don't have to
take the time to explain.

> > Then ask upstream how they think it can and should be done.
> 
> Upstream would be Ian Lance Taylor, right?

I don't know.

> > > > > -CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum
> > > > > libgo.log
> > > > > +CLEANFILES = *.go *.gox goc2c *.c s-* libgo.sum libgo.log
> > > > 
> > > > This seems unrelated?
> > > > 
> > > No, this is not unrelated: With this patch you can
> > > make -C build/i686-gnu/libgo clean
> > > make -C build/i686-gnu/libgo
> > > to rebuild libgo. Otherwise libcalls.go is not regenerated,
> > > mksysinfo.sh is not run etc. 
> > 
> > That's still unrelated to the matter here: porting go to
> > GNU/Hurd.  It
> > looks like a bug fix which is completely independant from GNU/Hurd.
> 
> Yes it is not Hurd-related. Maybe this should be filed as a separate
> bug. To gcc upstream directly?

Yes.

> > > > We could rather just implement the comm field in ps, AIUI it's
> > > > just an alias for the command field.
> > > 
> > > Your choice. When implemented this patch wouldn't bee needed.
> > 
> > Then please do implement it :)
> 
> Sorry, I need help for doing this. Any other Hurd developer listening?

See spec_abbrevs in utils/ps.c, I guess it's a matter of adding
{"Comm=args"} in the list.

Samuel


Re: Hurd port for gcc go PATCH 1-4(23)

2016-11-27 Thread Svante Signell
On Sun, 2016-11-27 at 18:02 +0100, Samuel Thibault wrote:
> Hello,
...
> > But as you wish, an updated patch is attached.
> 
>  _Bool
>  Continued (uint32_t *w)
>  {
> +#ifndef WCONTINUED
> +  *w = 0;
> +  return 0;
> +#else
>    return WIFCONTINUED (*w) != 0;
> +#endif
>  }
> 
> Err, recheck the semantic of WCONTINUED again, it doesn't modify its
> parameter, it just tests its value.
> 
> Do as I said, just return 0.
> 

No I can't the compiler complains about an unused variable. Maybe
adding an __attribute__((unused)) to the function header?

...

> 
> > This is for upstream to decide.
> 
> I'm just afraid they'd just frown on the code submission and not take
> the time to explain how they want it to look like if we don't raise
> the
> discussion ourselves.
> 

Should we propose these changes upstream? Or do you mean something
else? 

> > > And
> > > src_libgo_go_syscall_syscall_gnu_test.go: New file:
> > >   Define Type and Whence as 32bit in syscall.Flock_t
> > > 
> > > Again, you'll probably have to discuss with upstream to see how
> > > they
> > > prefer to make it configurable rather than forking the whole
> > > file.
> > > 
> > 
> > I tried to patch the syscall_unix_test.go file, but did not
> > succeed. 
> > Definitely if runtime.GOOS == "GNU" ... else ... or switch
> > runtime.GOOS
> > ... does not work. The compiler sees all code and complains, also
> > the
> > else part of the code :( Therefore I created a new file.
> 
> Then ask upstream how they think it can and should be done.
> 

Upstream would be Ian Lance Taylor, right?

> > > > -CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum
> > > > libgo.log
> > > > +CLEANFILES = *.go *.gox goc2c *.c s-* libgo.sum libgo.log
> > > 
> > > This seems unrelated?
> > > 
> > No, this is not unrelated: With this patch you can
> > make -C build/i686-gnu/libgo clean
> > make -C build/i686-gnu/libgo
> > to rebuild libgo. Otherwise libcalls.go is not regenerated,
> > mksysinfo.sh is not run etc. 
> 
> That's still unrelated to the matter here: porting go to
> GNU/Hurd.  It
> looks like a bug fix which is completely independant from GNU/Hurd.

Yes it is not Hurd-related. Maybe this should be filed as a separate
bug. To gcc upstream directly?

> > > 
> > > 
> > > We could rather just implement the comm field in ps, AIUI it's
> > > just an alias for the command field.
> > 
> > Your choice. When implemented this patch wouldn't bee needed.
> 
> Then please do implement it :)

Sorry, I need help for doing this. Any other Hurd developer listening?

Thanks for reviewing :) Nice to see that anybody cares.



[wwwdocs] Use "command-line option" (with a dash)

2016-11-27 Thread Gerald Pfeifer
Since I just responded to a recent patch where the dash was missing,
I noticed we had a couple of older cases in our web pages as well.

Fixed thusly.

Gerald

Index: gcc-4.6/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/changes.html,v
retrieving revision 1.154
diff -u -r1.154 changes.html
--- gcc-4.6/changes.html28 May 2016 20:40:35 -  1.154
+++ gcc-4.6/changes.html27 Nov 2016 14:04:06 -
@@ -178,7 +178,7 @@
   linker on ELF targets.  Plugin support of the Apple linker on
   Darwin is not compatible with GCC.
   The linker plugin can also be controlled by the
-  -fuse-linker-plugin command line option.
+  -fuse-linker-plugin command-line option.
   Resolution information from the linker plugin is used to drive
whole program assumptions. Use of the linker plugin results in
more aggressive optimization on binaries and on shared libraries
@@ -329,7 +329,7 @@
 #pragma GCC diagnostic pop
   foo(c);  /* error is given for this one */
 #pragma GCC diagnostic pop
-  foo(d);  /* depends on command line options */
+  foo(d);  /* depends on command-line options */
 
 The -fmax-errors=N option is now supported.  Using
 this option causes the compiler to exit after N errors
@@ -978,7 +978,7 @@
  callee for functions taking parameters with sub-word size in 32-bit
  mode, since this is redundant with the specification of the ABI.
  GCC has never done so in 64-bit mode since this is also redundant.
-The command line option -mfix-at697f has been added to
+The command-line option -mfix-at697f has been added to
 enable the documented workaround for the single erratum of the Atmel
 AT697F processor.
   
Index: gcc-4.7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.7/changes.html,v
retrieving revision 1.143
diff -u -r1.143 changes.html
--- gcc-4.7/changes.html29 Feb 2016 22:36:51 -  1.143
+++ gcc-4.7/changes.html27 Nov 2016 14:04:06 -
@@ -753,8 +753,8 @@
 New command-line options -maccumulate-args,
   -mbranch-cost=cost and -mstrict-X
   were added to allow better fine-tuning of code optimization.
-The command option -fdata-sections now also takes affect
-  on the section names of variables with the progmem
+The command-line option -fdata-sections now also takes
+  affect on the section names of variables with the progmem
   attribute.
 A new inline assembler print modifier %i to print a RAM 
address as I/O
 address has been added:
Index: news.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/news.html,v
retrieving revision 1.151
diff -u -r1.151 news.html
--- news.html   20 Aug 2016 09:47:09 -  1.151
+++ news.html   27 Nov 2016 14:04:07 -
@@ -1271,7 +1271,7 @@
 
 The new back end combines code generation for the Arm, the Thumb and
 the StrongArm into one compiler, with the target processor and
-instruction sets being selectable via command line switches.
+instruction sets being selectable via command-line switches.
 
 
 April 30, 2000


Re: [patch, libfortran] Add AVX-specific matmul

2016-11-27 Thread Thomas Koenig

I wrote:


As an added bonus, I added some m4 hacks to disable both
AVX and AVX2 code generation for REAL.


This should have read "I hadded some m4 hacks to disable
the AVX2 code generation for REAL."

Regards

Thomas


Re: [patch, libfortran] Add AVX-specific matmul

2016-11-27 Thread Thomas Koenig

Hello world,

here is another, much revised, update of the AVX-specific matmul patch.

The processor-specific switching is now done directly, using the
machinery from gcclib. For this, I have moved information from
the i386-specific cpuinfo.c file to a new header file cpuinfo.h,
which is then accessed from the matmul function to select the
correct version for the deteced CPU.

For matmul itself, the workhorse function was put into its
own file, which is then included multiple times with
name and target attributes set correctly.

So far, this patch is Intel only.  Jerry's benchmarks indicated
that AVX is actually slower on AMD chips.  Some googing reveals
that other people have had similar experience.

Using AVX128 for AMD processors would be somewhat beneficial,
but that currently cannot be specified as a target attribute.
I'll leave that for later.

As an added bonus, I added some m4 hacks to disable both
AVX and AVX2 code generation for REAL.

So, what do you think?  Is this the right way forward, especially
regarding the CPU detection part?

Regards

Thomas

2016-11-27  Thomas Koenig  

PR fortran/78379
* config/i386/cpuinfo.c:  Move denums for processor vendors,
processor type, processor subtypes and declaration of
struct __processor_model into
* config/i386/cpuinfo.h:  New header file.
* Makefile.am:  Add dependence of m4/matmul_internal_m4 to
mamtul files..
* Makefile.in:  Regenerated.
* acinclude.m4:  Check for AVX, AVX2 and AVX512F.
* config.h.in:  Add HAVE_AVX, HAVE_AVX2 and HAVE_AVX512F.
* configure:  Regenerated.
* configure.ac:  Use checks for AVX, AVX2 and AVX_512F.
* m4/matmul_internal.m4:  New file. working part of matmul.m4.
* m4/matmul.m4:  Implement architecture-specific switching
for AVX, AVX2 and AVX512F by including matmul_internal.m4
multiple times.
* generated/matmul_c10.c: Regenerated.
* generated/matmul_c16.c: Regenerated.
* generated/matmul_c4.c: Regenerated.
* generated/matmul_c8.c: Regenerated.
* generated/matmul_i1.c: Regenerated.
* generated/matmul_i16.c: Regenerated.
* generated/matmul_i2.c: Regenerated.
* generated/matmul_i4.c: Regenerated.
* generated/matmul_i8.c: Regenerated.
* generated/matmul_r10.c: Regenerated.
* generated/matmul_r16.c: Regenerated.
* generated/matmul_r4.c: Regenerated.
* generated/matmul_r8.c: Regenerated.


[Full patch at https://gcc.gnu.org/ml/fortran/2016-11/msg00246.html ,
this was rejected for reasons of size]



Re: Hurd port for gcc go PATCH 1-4(23)

2016-11-27 Thread Samuel Thibault
Hello,

Svante Signell, on Sun 27 Nov 2016 17:33:52 +0100, wrote:
> > > Index: gcc-6-6.2.1-4.1/src/libgo/go/syscall/wait.c
> > > ===
> > > --- gcc-6-6.2.1-4.1.orig/src/libgo/go/syscall/wait.c
> > > +++ gcc-6-6.2.1-4.1/src/libgo/go/syscall/wait.c
> > > @@ -8,6 +8,9 @@
> > > OS-independent.  */
> > >  
> > >  #include 
> > > +#ifndef WCONTINUED
> > > +#define WCONTINUED 0
> > > +#endif
> > >  #include 
> > >  
> > >  #include "runtime.h"
> > 
> > That looks odd at best: WCONTINUED can't be defined at this place
> > anyway, so it'll get defined to 0. Fortunately the sys/wait.h
> > definition
> > would override this. But then wait.c will define something which does
> > not make sense since WCONTINUED is not implemented. Better use #ifdef
> > WCONTINUED inside the Continued function, to always return 0 when
> > it's
> > not defined.
> > 
> 
> I've been implementing that version too, with no visible differences.

"no visible differences" doesn't mean there is none :)

> But as you wish, an updated patch is attached.

 _Bool
 Continued (uint32_t *w)
 {
+#ifndef WCONTINUED
+  *w = 0;
+  return 0;
+#else
   return WIFCONTINUED (*w) != 0;
+#endif
 }

Err, recheck the semantic of WCONTINUED again, it doesn't modify its
parameter, it just tests its value.

Do as I said, just return 0.



> This is for upstream to decide.

I'm just afraid they'd just frown on the code submission and not take
the time to explain how they want it to look like if we don't raise the
discussion ourselves.



> > And
> > src_libgo_go_syscall_syscall_gnu_test.go: New file:
> >   Define Type and Whence as 32bit in syscall.Flock_t
> > 
> > Again, you'll probably have to discuss with upstream to see how they
> > prefer to make it configurable rather than forking the whole file.
> >
> 
> I tried to patch the syscall_unix_test.go file, but did not succeed. 
> Definitely if runtime.GOOS == "GNU" ... else ... or switch runtime.GOOS
> ... does not work. The compiler sees all code and complains, also the
> else part of the code :( Therefore I created a new file.

Then ask upstream how they think it can and should be done.



> > > @@ -4431,7 +4505,7 @@ mostlyclean-local:
> > >   find . -name '*-testsum' -print | xargs rm -f
> > >   find . -name '*-testlog' -print | xargs rm -f
> > >  
> > > -CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum libgo.log
> > > +CLEANFILES = *.go *.gox goc2c *.c s-* libgo.sum libgo.log
> > 
> > This seems unrelated?
> > 
> No, this is not unrelated: With this patch you can
> make -C build/i686-gnu/libgo clean
> make -C build/i686-gnu/libgo
> to rebuild libgo. Otherwise libcalls.go is not regenerated,
> mksysinfo.sh is not run etc. 

That's still unrelated to the matter here: porting go to GNU/Hurd.  It
looks like a bug fix which is completely independant from GNU/Hurd.

> > Svante Signell, on Fri 25 Nov 2016 21:04:58 +0100, wrote:
> > > * src_libgo_runtime_netpoll.goc.diff: Fix restricted word bug.
> > >   Rename variable errno to errno1.
> > > * src_libgo_go_os_os_test.go.diff: Allow EFBIG return code to big
> > > seeks.
> > > * src_libgo_go_syscall_syscall_gnu_test.go: New file:
> > >   Define Type and Whence as 32bit in syscall.Flock_t
> > > * src_libgo_testsuite_gotest.diff: Remove comm option for ps -o.
> > > * add-gnu-to-libgo-headers.diff:
> > >   Add gnu to +build entry in file headers included in the build.
> > >   FIXME:  
> > 
> > I can't find these in the patches you sent.
> 
> It is in the last mail: patch 19-23(23)

Ah, sorry, mutt had pasted the content of the attached files without
putting the file names.

> > > Index: gcc-6-6.2.1-4.1/src/libgo/testsuite/gotest
> > > ===
> > > --- gcc-6-6.2.1-4.1.orig/src/libgo/testsuite/gotest
> > > +++ gcc-6-6.2.1-4.1/src/libgo/testsuite/gotest
> > > @@ -618,7 +618,11 @@ xno)
> > >   wait $pid
> > >   status=$?
> > >   if ! test -f gotest-timeout; then
> > > - sleeppid=`ps -o pid,ppid,comm | grep "
> > > $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
> > > + if test "$goos" = "gnu"; then
> > > + sleeppid=`ps -o pid,ppid | grep "
> > > $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
> > > + else
> > > + sleeppid=`ps -o pid,ppid,comm | grep "
> > > $alarmpid " | grep sleep | sed -e 's/ *\([0-9]*\) .*$/\1/'`
> > > + fi
> > >   kill $alarmpid
> > >   wait $alarmpid
> > >   if test "$sleeppid" != ""; then
> > 
> > 
> > We could rather just implement the comm field in ps, AIUI it's just
> > an
> > alias for the command field.
> 
> Your choice. When implemented this patch wouldn't bee needed.

Then please do implement it :)

Samuel


New French PO file for 'gcc' (version 6.2.0)

2016-11-27 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the French team of translators.  The file is available at:

http://translationproject.org/latest/gcc/fr.po

(This file, 'gcc-6.2.0.fr.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Re: [wwwdocs][PATCH][ARM] Add -mpure-code to changes.html

2016-11-27 Thread Gerald Pfeifer
On Mon, 21 Nov 2016, Andre Vieira (lists) wrote:
> I added the description of the new ARM -mpure-code option to changes.html.

Just as a note, per https://gcc.gnu.org/codingconventions.html#Spelling 
we are using "command-line option" (with a dash).

I applied the obvious change (below) on top of yours.

Gerald

Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-7/changes.html,v
retrieving revision 1.30
diff -u -r1.30 changes.html
--- changes.html23 Nov 2016 07:38:58 -  1.30
+++ changes.html23 Nov 2016 11:48:03 -
@@ -389,7 +389,7 @@
-mtune=cortex-m33.
  
  
-   A new command line option -mpure-code has been added.
+   A new command-line option -mpure-code has been added.
It does not allow constant data to be placed in code sections.
This option is only available when generating non-pic code for ARMv7-M
targets.
@@ -423,7 +423,7 @@
   /* Returns array + 0x4000 + 2 * idx. */
   return array[idx];
 }
-  A new command line option -Wmisspelled-isr has been added.
+  A new command-line option -Wmisspelled-isr has been added.
 It can be used to turn off  or turn into errors 
 warnings that are reported for interrupt service routines (ISRs)
 which don't follow AVR-LibC's naming convention of prefixing