Re: [PATCH v2] ARM: Use different linker path for hardfloat ABI

2012-05-01 Thread Richard Earnshaw
On 30/04/12 22:47, Michael Hope wrote:
> On 1 May 2012 03:24, Richard Earnshaw  wrote:
>> On 27/04/12 00:27, Michael Hope wrote:
>>> On 27 April 2012 08:20, Carlos O'Donell  wrote:
 On Mon, Apr 23, 2012 at 5:36 PM, Michael Hope  
 wrote:
> 2012-04-24  Michael Hope  
>Richard Earnshaw  
>
>* config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_SOFT_FLOAT): 
> Define.
>(GLIBC_DYNAMIC_LINKER_HARD_FLOAT): Define.
>(GLIBC_DYNAMIC_LINKER_DEFAULT): Define.
>(GLIBC_DYNAMIC_LINKER): Redefine to use the hard float path.
>
> diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
> index 80bd825..2ace6f0 100644
> --- a/gcc/config/arm/linux-eabi.h
> +++ b/gcc/config/arm/linux-eabi.h
> @@ -62,7 +62,17 @@
>  /* Use ld-linux.so.3 so that it will be possible to run "classic"
>GNU/Linux binaries on an EABI system.  */
>  #undef  GLIBC_DYNAMIC_LINKER
> -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
> +#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
> +#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
> +#if TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_HARD
> +#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_HARD_FLOAT
> +#else
> +#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
> +#endif
> +#define GLIBC_DYNAMIC_LINKER \
> +   "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
> +%{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
> +%{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
>
>  /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
>use the GNU/Linux version, not the generic BPABI version.  */

 This patch is broken. Please fix this.

 You can't use a named enumeration in cpp equality.

 The type ARM_FLOAT_ABI_HARD is a named enumeration and evaluates to 0
 as an unknown identifier.

 Therefore "#if TARGET_DEFAULT_FLOAT_ABI == ARM_FLOAT_ABI_HARD"
 evaluates to "#if 0 == 0" and is always true.

 Watch out that "#define ARM_FLOAT_ABI_HARD ARM_FLOAT_ABI_HARD" for
 such enums is not conforming C99/C11.

 I suggest you define the types as macros and then set the named enum
 to those values, then use the macros in the header equality checks.

 e.g.
 #define VAL1 0 then enum FOO { RVAL1 = VAL1, ... }

 Look at arm.h for the enum definition.
>>>
>>> I've looked further into this and I think the original pre-#if version
>>> is correct.
>>>
>>> The float ABI comes from these places:
>>>  * The -mfloat-abi= command line argument, else
>>>  * The --with-float= configure time argument, else
>>>  * TARGET_DEFAULT_FLOAT_ABI from linux-eabi.h
>>>
>>> In the first case the ABI is explicit.  In the second
>>> OPTION_DEFAULT_SPECS turns the configure time argument into an explict
>>> -mfloat-abi=.
>>>
>>> The patch below covers all cases, keeps the logic in the spec file,
>>> and adds a comment linking the two #defines.
>>>
>>> Tested by building with no configure flags, --wtih-float=softfp,
>>> --with-float=hard, and then running with all combinations of
>>> {,-mfloat-abi=softfp,-mfloat-abi=hard} {,-mglibc,-muclibc,-mbionic}.
>>>
>>> OK?
>>>
>>> -- Michael
>>>
>>> 2012-04-27  Michael Hope  
>>>
>>>   * config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER): Pick the loader
>>>   using a spec rule.
>>>
>>
>> Michael,
>>
>> can you try this patch please.  It should make it possible to then
>> create linux-eabihf.h containing just
>>
>> #undef TARGET_DEFAULT_FLOAT_ABI
>> #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
>> #undef GLIBC_DYNAMIC_LINKER_DEFAULT
>> #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_HARD_FLOAT
>>
>> Which is not quite as simple as leaving out the second re-define, but
>> pretty close.
> 
> Hi Richard.  Your patch tests just fine.  I like it.  You could change
> the spec rule to the newer if-elseif-else form but that's a nit.
> 
> -- Michael
> 

Great, thanks!  I've committed it as is.

R.



Re: Fix find_moveable_pseudos, PR52997

2012-05-01 Thread Richard Sandiford
Bernd Schmidt  writes:
>   * ira.c (allocated_reg_info_size): New static variable.
>   (expand_reg_info): Manage it. Call
>   setup_preferred_alternate_classes_for_new_pseudos.
>   (ira): Don't do it here.  Remove local allocated_reg_info_size,
>   set the global before calling find_moveable_pseudos.
>   (find_moveable_pseudos): Call expand_reg_info rather than
>   resize_reg_info.

OK, thanks.

Richard


Re: [rx] add initial rtx_costs() function

2012-05-01 Thread nick clifton

Hi DJ,


Initial implementation of RTX_COSTS target function for rx-elf.  Minor
increase in coremark scores, and enables division by multiplication of
reciprocals, tested on trunk and 4.7.  Ok for trunk and/or 4.7 branch?

* config/rx/rx.c (TARGET_RTX_COSTS): Define.
(rx_rtx_costs): New.


OK for both.

Cheers
  Nick



Re: Patches to enable -ftrack-macro-expansion by default

2012-05-01 Thread Dodji Seketeli
Uros Bizjak  writes:

> Your patch introduced:
>
> FAIL: gcc.dg/gomp/macro-4.c (internal compiler error)
> FAIL: gcc.dg/gomp/macro-4.c (test for excess errors)
>
> on alphaev68-pc-linux-gnu. The failure is silent on
> x86_64-pc-linux-gnu, but can be uncovered by valgrind:
>
> $ valgrind ~/gcc-build/gcc/cc1 -fopenmp -Wunknown-pragmas macro-4.c
>
> ==2461== Conditional jump or move depends on uninitialised value(s)
> ==2461==at 0xE2B9D2: _cpp_pop_context (macro.c:2143)
> ==2461==by 0xE1B1EF: skip_rest_of_line(cpp_reader*) (directives.c:207)
> ==2461==by 0xE1BBFE: end_directive(cpp_reader*, int)
> (directives.c:298)

I see.  Thank you for raising this, and sorry for the inconvenience.

I have a patchlet that seems to make the Valgrind error go away for me
on x86_64-unknown-linux-gnu.  The bootstrap is still underway.

Could you please test that it address the issue for you on
alphaev68-pc-linux-gnu?

Here is the patch, with its introductory text.  Thanks.

>From 3e8a8ff118d6fbf038802348bac51ce1dbd26647 Mon Sep 17 00:00:00 2001
From: Dodji Seketeli 
Date: Tue, 1 May 2012 11:14:45 +0200
Subject: [PATCH] Properly initialize cpp_context in destringize_and_run

destringize_and_run forgets to initialize all the fields of the
cpp_context that it pushes.  Later _cpp_pop_context then gets confused
when it accesses context->tokens_kind via the call to macro_of_context
on context->prev.

The first hunk of this patch is the real obvious fix.  The second hunk
is just an assert that I am adding to err on the safe side.

Tested on x86_64-unknown-linux-gnu against trunk by running the
test gcc.dg/gomp/macro-4.c under Valgrind.  Bootstrap is still
underway.

libcpp/

* directives.c (destringize_and_run): Properly initialize the new
context.
* macro.c (_cpp_pop_context): Assert that we shouldn't try to pop
the initial base context, which has the same life time as the
current instance of cpp_file.
---
 libcpp/directives.c |4 +---
 libcpp/macro.c  |4 
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libcpp/directives.c b/libcpp/directives.c
index 0510c6e..c1c2415 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1742,9 +1742,7 @@ destringize_and_run (cpp_reader *pfile, const cpp_string 
*in)
   saved_cur_run = pfile->cur_run;
 
   pfile->context = XNEW (cpp_context);
-  pfile->context->c.macro = 0;
-  pfile->context->prev = 0;
-  pfile->context->next = 0;
+  memset (pfile->context, 0, sizeof (cpp_context));
 
   /* Inline run_directive, since we need to delay the _cpp_pop_buffer
  until we've read all of the tokens that we want.  */
diff --git a/libcpp/macro.c b/libcpp/macro.c
index ab3e8f6..c4e2a23 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -2152,6 +2152,10 @@ _cpp_pop_context (cpp_reader *pfile)
 {
   cpp_context *context = pfile->context;
 
+  /* We should not be popping the base context.  */
+  if (context == &pfile->base_context)
+abort ();
+
   if (context->c.macro)
 {
   cpp_hashnode *macro;
-- 
Dodji


Re: Patches to enable -ftrack-macro-expansion by default

2012-05-01 Thread Dodji Seketeli
Dodji Seketeli  writes:

> Tested on x86_64-unknown-linux-gnu against trunk by running the
> test gcc.dg/gomp/macro-4.c under Valgrind.  Bootstrap is still
> underway.

For what it's worth, the patch passes bootstrap on
x86_64-unknown-linux-gnu.

> libcpp/
>
>   * directives.c (destringize_and_run): Properly initialize the new
>   context.
>   * macro.c (_cpp_pop_context): Assert that we shouldn't try to pop
>   the initial base context, which has the same life time as the
>   current instance of cpp_file.

-- 
Dodji


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Paolo Carlini

On 05/01/2012 06:28 AM, Jason Merrill wrote:

On 04/30/2012 07:37 PM, Paolo Carlini wrote:

Thus, my question would be: is something like the below in the right
direction? The alternate possibility I can see, would be basically
redoing a slightly slimmed version of for_each_template_parm specialized
for our needs (a few less conditionals)
I think either approach would be fine; I lean toward the first, but 
changing the name and adding a flag for clarity.  Changing the walking 
behavior based on fn being null is too subtle.

Agreed. The below is what I booted and tested on x86_64-linux.

Thanks,
Paolo.

///
/cp
2012-05-01  Paolo Carlini  

PR c++/51222
* pt.c (for_each_template_parm): Rename to walk_template_parms,
add any_p bool parameter.
(mark_template_parm, uses_template_parms_level): Adjust.
(instantiation_dependent_expression_p): New.
(finish_decltype_type): Use it.
* cp-tree.h: Update declarations.

/testsuite
2012-05-01  Paolo Carlini  

PR c++/51222
* g++.dg/cpp0x/decltype37.C: New.
Index: testsuite/g++.dg/cpp0x/decltype37.C
===
--- testsuite/g++.dg/cpp0x/decltype37.C (revision 0)
+++ testsuite/g++.dg/cpp0x/decltype37.C (revision 0)
@@ -0,0 +1,101 @@
+// PR c++/51222
+// { dg-options -std=c++11 }
+
+template
+struct add_rref {
+  typedef T&& type;
+};
+
+template<>
+struct add_rref {
+  typedef void type;
+};
+
+template
+typename add_rref::type declval();
+
+template()))
+>
+auto f(int) -> char;
+
+template
+auto f(...) -> char(&)[2];
+
+template
+auto g(int) -> char;
+
+template
+auto g(...) -> char(&)[2];
+
+template
+auto f2(int) -> decltype(::delete ::new T(declval()), char());
+
+template
+auto f2(...) -> char(&)[2];
+
+template
+auto g2(int) -> decltype(::delete ::new T(), char());
+
+template
+auto g2(...) -> char(&)[2];
+
+struct C { };
+
+struct A {
+  virtual ~A() = 0;
+};
+
+struct D1 {
+  D1() = delete;
+};
+
+struct D2 {
+  ~D2() = delete;
+};
+
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(g(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+static_assert(sizeof(f(0)) == 2, "Ouch");
+
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(g2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
+static_assert(sizeof(f2(0)) == 2, "Ouch");
Index: cp/pt.c
===
--- cp/pt.c (revision 187012)
+++ cp/pt.c (working copy)
@@ -145,8 +145,8 @@ static tree convert_nontype_argument_function (tre
 static tree convert_nontype_argument (tree, tree, tsubst_flags_t);
 static tree convert_template_argument (tree, tree, tree,
   tsubst_flags_t, int, tree);
-static int for_each_template_parm (tree, tree_fn_t, void*,
-  struct pointer_set_t*, bool);
+static int walk_template_parms (tree, tree_fn_t, void*,
+   struct pointer_set_t*, bool, bool);
 static tree expand_template_argument_pack (tree);
 static tree build_template_parm_index (int, int, int, int, tree, tree);
 static bool inline_needs_template_parms (tree);
@@ -185,7 +185,7 @@ static int coerce_template_template_parms (tree, t
 static bool template_template_parm_bindings_ok_p (tree, tree);
 static int template_args_equal (tree, tree);
 static void tsubst_default_arguments (tree);
-static tree for_each_template_parm_r (tree *, int *, v

Add myself to write-after-approval section of MAINTAINERS file

2012-05-01 Thread Greta Yorsh
I have just committed the patch below to add myself to the
write-after-approval section of the MAINTAINERS file.

Thanks,

Greta

ChangeLog:

2012-05-01  Greta Yorsh  

* MAINTAINERS (Write After Approval): Add myself.


Index: MAINTAINERS
===
--- MAINTAINERS (revision 187012)
+++ MAINTAINERS (working copy)
@@ -530,6 +530,7 @@
 Canqun Yangcan...@nudt.edu.cn
 Jeffrey Yasskinjyass...@google.com
 Joey Yejoey...@arm.com
+Greta Yorshgreta.yo...@arm.com
 David Yustedavid.yu...@gmail.com
 Kirill Yukhin  kirill.yuk...@gmail.com
 Kenneth Zadeck zad...@naturalbridge.com





Ping: [Patch, Makefile.in, doc] Add new @include in doc/invoke.texi

2012-05-01 Thread Georg-Johann Lay

The following patch has some parts that still need approval, i.e.

* Makefile.in (TEXI_GCC_FILES): Add avr-mmcu.texi.
* doc/avr-mmcu.texi: New auto-generated file.
* doc/invoke.texi (AVR Options): Include avr-mmcu.texi in order
  to document all valid -mmcu= arguments.

http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00961.html

The avr-specific part is already approved:

http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00976.html

Thanks,

Johann


This patch adds a new file ./gcc/doc/avr-mmcu.texi that lists all valid
-mmcu= settings and replaces the respective text in invoke.texi by
@include avr-mmcu.texi

Up to now, there is no complete list of -mmcu= options, and a list is
hard to maintain by hand because it contains more than 180 devices.

If, during the build of avr-gcc, a change of ./gcc/doc/avr-mmcu.texi
is detected, the build aborts with a message that nags the user to
copy the new content of avr-mmcu.texi to ./gcc/doc/avr-mmcu.texi.

The error message's text is:

*** Verify that you have permission to grant a
*** GFDL license for all new text in
*** avr-mmcu.texi, then copy it to $(srcdir)/doc/avr-mmcu.texi

./gcc/doc/avr-mmcu.texi is auto-generated, but there is no rule to
automatically update it during the build process.

Documents (HTML, PDF, ...) build fine.

Ok for trunk?

If it's appropriate for 4.7, I'd change invoke.texi accordingly by
copy-pasting the auto-generated texi code into that file, i.e.
into section "AVR Options".

Johann

* Makefile.in (TEXI_GCC_FILES): Add avr-mmcu.texi.

* doc/avr-mmcu.texi: New auto-generated file.
* doc/invoke.texi (AVR Options): Include avr-mmcu.texi in order
to document all valid -mmcu= arguments.

* config/avr/avr.h (arch_info_s): New struct definition.
* config/avr/avr-devices.c (avr_texinfo): New variable.
* config/avr/gen-avr-mmcu-texi.c: New file.
* config/avr/t-avr: New rules and dependencies to build avr-mmcu.texi.





Ping: [Patch, Makefile.in, doc] Add new @include in doc/invoke.texi

2012-05-01 Thread Georg-Johann Lay

The following patch has some parts that still need approval, i.e.

* Makefile.in (TEXI_GCC_FILES): Add avr-mmcu.texi.
* doc/avr-mmcu.texi: New auto-generated file.
* doc/invoke.texi (AVR Options): Include avr-mmcu.texi in order
  to document all valid -mmcu= arguments.

http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00961.html

The avr-specific part is already approved:

http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00976.html

Thanks,

Johann

> This patch adds a new file ./gcc/doc/avr-mmcu.texi that lists all valid
> -mmcu= settings and replaces the respective text in invoke.texi by
> @include avr-mmcu.texi
>
> Up to now, there is no complete list of -mmcu= options, and a list is
> hard to maintain by hand because it contains more than 180 devices.
>
> If, during the build of avr-gcc, a change of ./gcc/doc/avr-mmcu.texi
> is detected, the build aborts with a message that nags the user to
> copy the new content of avr-mmcu.texi to ./gcc/doc/avr-mmcu.texi.
>
> The error message's text is:
>
> *** Verify that you have permission to grant a
> *** GFDL license for all new text in
> *** avr-mmcu.texi, then copy it to $(srcdir)/doc/avr-mmcu.texi
>
> ./gcc/doc/avr-mmcu.texi is auto-generated, but there is no rule to
> automatically update it during the build process.
>
> Documents (HTML, PDF, ...) build fine.
>
> Ok for trunk?
>
> If it's appropriate for 4.7, I'd change invoke.texi accordingly by
> copy-pasting the auto-generated texi code into that file, i.e.
> into section "AVR Options".
>
> Johann
>
> * Makefile.in (TEXI_GCC_FILES): Add avr-mmcu.texi.
>
> * doc/avr-mmcu.texi: New auto-generated file.
> * doc/invoke.texi (AVR Options): Include avr-mmcu.texi in order
> to document all valid -mmcu= arguments.
>
> * config/avr/avr.h (arch_info_s): New struct definition.
> * config/avr/avr-devices.c (avr_texinfo): New variable.
> * config/avr/gen-avr-mmcu-texi.c: New file.
> * config/avr/t-avr: New rules and dependencies to build 
avr-mmcu.texi.


RE: [Patch, ARM] rename thumb_unexpanded_epilogue to thumb1_unexpanded_epilogue

2012-05-01 Thread Greta Yorsh
Ping!
http://gcc.gnu.org/ml/gcc-patches/2012-04/msg01485.html

Thanks,
Greta

> -Original Message-
> From: Greta Yorsh [mailto:greta.yo...@arm.com]
> Sent: 24 April 2012 17:41
> To: gcc-patches@gcc.gnu.org
> Cc: p...@codesourcery.com; Ramana Radhakrishnan; Richard Earnshaw;
> ni...@redhat.com
> Subject: [Patch, ARM] rename thumb_unexpanded_epilogue to
> thumb1_unexpanded_epilogue
> 
> Rename thumb_unexpanded_epilogue to thumb1_unexpanded_epilogue.
> 
> In preparation for epilogue generation in RTL and anyway it's the right
> name
> for this function.
> 
> Ok for trunk?
> 
> Thanks,
> Greta
> 
> gcc/ChangeLog
> 
> 2012-04-24  Ian Bolton  
> Sameera Deshpande  
> Greta Yorsh  
> 
> * config/arm/arm-protos.h (thumb_unexpanded_epilogue): Rename
> to...
> (thumb1_unexpanded_epilogue): ...this.
> * config/arm/arm.c (thumb_unexpanded_epilogue): Rename to...
> (thumb1_unexpanded_epilogue): ...this.
> * config/arm/arm.md (thumb_unexpanded_epilogue): Rename to...
> (thumb1_unexpanded_epilogue): ...this.





Re: Patches to enable -ftrack-macro-expansion by default

2012-05-01 Thread Jason Merrill

On 05/01/2012 05:36 AM, Dodji Seketeli wrote:

pfile->context = XNEW (cpp_context);
+  memset (pfile->context, 0, sizeof (cpp_context));


You can use XCNEW instead of XNEW + memset.

OK with that change.

Jason


PR c/51712 -Wtype-limits should not trigger for types of implementation-defined signedness

2012-05-01 Thread Manuel López-Ibáñez
This fixes half of PR51712. The other half is added as XFAIL.
Bootstrapped and regression tested.

OK?

Fixing the other half requires either

* Make build_binary_op take c_expr instead of trees. This will require adding
c_expr to the C++ FE. For now, the C++ FE will just encapsulate the trees into
c_expr before calling  build_binary_op and nothing else. If the long-term goal
is that C/C++ FEs track the original source code more faithfully, I think this
is the right step. The use of c_expr should help to achieve this.

* Pass 4 more arguments to build_binary_op, and add a
wrapper to avoid changing the interface for C++ FE. This restricts the changes
to the C FE (and c-common.c) but it is really ugly.

Jason, what is your opinion about adding c_expr to the C++ FE?

2012-05-01  Manuel López-Ibáñez  

PR c/51712
c-family/
* c-common.c (expr_original_type): New.
(shorten_compare): Do not warn for enumeration types.
testsuite/
* c-c++-common/pr51712.c: New.


fix-pr51712.diff
Description: Binary data


Re: PR c/51712 -Wtype-limits should not trigger for types of implementation-defined signedness

2012-05-01 Thread Joseph S. Myers
On Tue, 1 May 2012, Manuel L?pez-Ib??ez wrote:

> +static tree expr_original_type (tree expr)

That should be

static tree
expr_original_type (tree expr)

with a comment explaining the semantics of the function.

> +{
> +  STRIP_NOPS (expr);

Are you sure you want STRIP_NOPS rather than STRIP_SIGN_NOPS here?  If so, 
could you ensure there are comments explaining why removing sign changes 
is safe in this context?

-- 
Joseph S. Myers
jos...@codesourcery.com

Re: PR c/51712 -Wtype-limits should not trigger for types of implementation-defined signedness

2012-05-01 Thread Manuel López-Ibáñez
On 1 May 2012 15:46, Joseph S. Myers  wrote:
> On Tue, 1 May 2012, Manuel López-Ibáñez wrote:
>
>> +static tree expr_original_type (tree expr)
>
> That should be
>
> static tree
> expr_original_type (tree expr)
>
> with a comment explaining the semantics of the function.
>
>> +{
>> +  STRIP_NOPS (expr);
>
> Are you sure you want STRIP_NOPS rather than STRIP_SIGN_NOPS here?  If so,
> could you ensure there are comments explaining why removing sign changes
> is safe in this context?

For getting the original enumeral type of a expr, why would sign changes matter?


>
> --
> Joseph S. Myers
> jos...@codesourcery.com


Re: [Patch, ARM] rename thumb_unexpanded_epilogue to thumb1_unexpanded_epilogue

2012-05-01 Thread Richard Earnshaw
On 24/04/12 17:41, Greta Yorsh wrote:
> Rename thumb_unexpanded_epilogue to thumb1_unexpanded_epilogue.
> 
> In preparation for epilogue generation in RTL and anyway it's the right name
> for this function.
> 
> Ok for trunk?
> 
> Thanks,
> Greta

OK.

R.

> 
> gcc/ChangeLog
> 
> 2012-04-24  Ian Bolton  
> Sameera Deshpande  
> Greta Yorsh  
> 
> * config/arm/arm-protos.h (thumb_unexpanded_epilogue): Rename to...
> (thumb1_unexpanded_epilogue): ...this.
> * config/arm/arm.c (thumb_unexpanded_epilogue): Rename to...
> (thumb1_unexpanded_epilogue): ...this.
> * config/arm/arm.md (thumb_unexpanded_epilogue): Rename to...
> (thumb1_unexpanded_epilogue): ...this.



Re: PR c/51712 -Wtype-limits should not trigger for types of implementation-defined signedness

2012-05-01 Thread Joseph S. Myers
On Tue, 1 May 2012, Manuel López-Ibáñez wrote:

> > Are you sure you want STRIP_NOPS rather than STRIP_SIGN_NOPS here?  If so,
> > could you ensure there are comments explaining why removing sign changes
> > is safe in this context?
> 
> For getting the original enumeral type of a expr, why would sign changes 
> matter?

What if the comparison is

  (unsigned) (expr_of_signed_enum_type) >= 0

?  (With GCC, the enum will have a signed type if one of its values is 
negative.)  That seems worth a warning - the point of the patch as I 
understand it is to avoid warning for

  (expr_of_unsigned_enum_type) >= 0

because being unsigned there is an implementation-defined matter.

-- 
Joseph S. Myers
jos...@codesourcery.com

Re: PR c/51712 -Wtype-limits should not trigger for types of implementation-defined signedness

2012-05-01 Thread Manuel López-Ibáñez
On 1 May 2012 16:00, Joseph S. Myers  wrote:
> On Tue, 1 May 2012, Manuel López-Ibáñez wrote:
>
>> > Are you sure you want STRIP_NOPS rather than STRIP_SIGN_NOPS here?  If so,
>> > could you ensure there are comments explaining why removing sign changes
>> > is safe in this context?
>>
>> For getting the original enumeral type of a expr, why would sign changes 
>> matter?
>
> What if the comparison is
>
>  (unsigned) (expr_of_signed_enum_type) >= 0
>
> ?  (With GCC, the enum will have a signed type if one of its values is
> negative.)  That seems worth a warning - the point of the patch as I
> understand it is to avoid warning for

What I understood from the PR is that we should never warn for enums.
But if you think we should warn for the above, using STRIPS_SIGN_NOPS
does warn for this and avoids the warning in the original testcase. Is
this version OK?

 +/* Given an expression as a tree, return its original type.  Do this
+   by stripping any conversion that generates no instruction but don't
+   let the signedness change.  */
+static tree
+expr_original_type (tree expr)
+{
+  STRIP_SIGN_NOPS (expr);
+  return TREE_TYPE (expr);
+}
+

(The important and hard to fix case is anyway to not warn for >= FOO,
which triggers more often and it is even more annoying and it is also
the one that Clang fixes and not this one.)

Cheers,

Manuel.


Re: [C Patch]: pr52543

2012-05-01 Thread Richard Sandiford
Ian Lance Taylor  writes:
> Richard Sandiford  writes:
>> Does anyone else have any thoughts before I make that change?
>
> I think that one of you should try to write a test case where it makes a
> difference, and add the test case to the testsuite.

I originally took that to mean a case where function vs. bb speed choices
made a difference.  That isn't really possible as things stand because
I don't know of any in-tree port that assigns different rtx costs to
SETs based on the speed setting.

But now I wonder whether you meant a test case where using rtx costs
makes a difference.  I'm not really in a position to test ARM these days,
but it sounds like any testcase for the VUNZP patch would cover this too,
since it was this patch that prevented the VUNZP one from going in.
I'll also try to come up with a MIPS testcase when I look at that
(this weekend hopefully, but maybe not on recent form).

Anyway, I modified the patch to use a per-function speed setting.
After the off-list discussion between you and Kenny, I went ahead
and applied it after retesting on x86_64-linux-gnu.

To repeat: as things stand, very few targets define proper rtx costs
for SET.  This patch is therefore expected to prevent lower-subreg
from running in cases where it's actually benefical.  If you see that
happening, please check whether the rtx_costs are defined properly.

Of course, if the costs are defined properly and lower-subreg still
makes the wrong choice, we need to look at why.

Richard


gcc/
2012-03-31  Kenneth Zadeck  
Richard Sandiford  

* Makefile.in (lower-subreg.o, target-globals.o): Depend on
lower-subreg.h.
* lower-subreg.h: New file.
* target-globals.h (this_target_lower_subreg): Declare.
(target_globals): Add lower_subreg;
(restore_target_globals): Restore this_target_lower_subreg.
* target-globals.c: Include it.
(default_target_globals): Add default_target_lower_subreg.
(save_target_globals): Initialize target_lower_subreg.
* rtl.h (init_lower_subreg): Added declaration.
* toplev.c (backend_init_target): Call initializer for lower-subreg
pass.
* lower-subreg.c (LOG_COSTS, FORCE_LOWERING): New macros.
(default_target_lower_subreg): New variable.
(this_target_lower_subreg): Likewise.
(twice_word_mode, choices): New macros.
(shift_cost, compute_splitting_shift, compute_costs)
(init_lower_subreg): New functions.
(resolve_simple_move): Add speed_p argument.  Check choices.
(find_pseudo_copy): Don't check the mode size here.
(resolve_simple_move): Assert the mode size.
(find_decomposable_shift_zext): Add speed_p argument and return
a bool.  Check choices.
(resolve_shift_zext): Add comment.
(dump_shift_choices, dump_choices): New functions.
(decompose_multiword_subregs): Dump list of profitable
transformations.  Add code to skip non profitable transformations.
Update calls to simple_move and find_decomposable_shift_zext.

Index: gcc/Makefile.in
===
--- gcc/Makefile.in 2012-05-01 09:42:28.612732994 +0100
+++ gcc/Makefile.in 2012-05-01 09:42:51.845652552 +0100
@@ -3428,11 +3428,13 @@ dbgcnt.o: dbgcnt.c $(CONFIG_H) $(SYSTEM_
 lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(MACHMODE_H) $(TM_H) $(RTL_H) $(TM_P_H) $(TIMEVAR_H) $(FLAGS_H) \
insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) $(OBSTACK_H) $(BITMAP_H) \
-   $(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H) dce.h
+   $(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H) dce.h \
+   lower-subreg.h
 target-globals.o : target-globals.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) insn-config.h $(MACHMODE_H) $(GGC_H) toplev.h target-globals.h \
$(FLAGS_H) $(REGS_H) $(RTL_H) reload.h expmed.h $(EXPR_H) $(OPTABS_H) \
-   $(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H) builtins.h gcse.h bb-reorder.h
+   $(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H) builtins.h gcse.h bb-reorder.h \
+   lower-subreg.h
 hw-doloop.o : hw-doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(FLAGS_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) \
$(DF_H) $(CFGLAYOUT_H) $(CFGLOOP_H) output.h $(RECOG_H) $(TARGET_H) \
Index: gcc/lower-subreg.h
===
--- /dev/null   2012-04-30 12:38:22.655823157 +0100
+++ gcc/lower-subreg.h  2012-05-01 09:42:51.849652538 +0100
@@ -0,0 +1,59 @@
+/* Target-dependent costs for lower-subreg.c.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option; any later
+version.
+
+GCC is distributed in the hope that it will be useful, but

Re: PR c/51712 -Wtype-limits should not trigger for types of implementation-defined signedness

2012-05-01 Thread Joseph S. Myers
On Tue, 1 May 2012, Manuel López-Ibáñez wrote:

> > What if the comparison is
> >
> >  (unsigned) (expr_of_signed_enum_type) >= 0
> >
> > ?  (With GCC, the enum will have a signed type if one of its values is
> > negative.)  That seems worth a warning - the point of the patch as I
> > understand it is to avoid warning for
> 
> What I understood from the PR is that we should never warn for enums.

I think the point is we shouldn't warn if the enum itself if part of the 
comparison - as opposed to the enum cast to some type whose signedness is 
not implementation-defined.  But at present it may be difficult to tell if 
there was an explicit cast of an unsigned enum to unsigned - but we can 
still detect the above case.

>  +/* Given an expression as a tree, return its original type.  Do this
> +   by stripping any conversion that generates no instruction but don't
> +   let the signedness change.  */

"generates no instruction" is not appropriate semantics for something 
related to diagnostics.  "any conversion that preserves the sign and 
precision"?  OK with that version.

-- 
Joseph S. Myers
jos...@codesourcery.com

[committed] Run DImode atomic tests on ppc64

2012-05-01 Thread Richard Henderson

Committed as obvious.


r~
* lib/target-supports.exp
(check_effective_target_sync_long_long_runtime): True for
check_effective_target_powerpc64.


diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 1a25324..b93dc5c 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3795,6 +3795,8 @@ proc check_effective_target_sync_long_long_runtime { } {
 && [check_effective_target_lp64]
 && [check_effective_target_ultrasparc_hw]) } {
return 1
+} elseif { [check_effective_target_powerpc64] } {
+   return 1
 } else {
return 0
 }


Re: [PATCH] libatomic, v2

2012-05-01 Thread Richard Henderson

On 04/27/2012 12:26 PM, Richard Henderson wrote:

I think the library is ready for merge back to mainline, but
I will wait until at least Monday for feedback and proximity
to my desk to deal with potential fallout.


Now committed.


r~


Re: Patches to enable -ftrack-macro-expansion by default

2012-05-01 Thread Dodji Seketeli
Jason Merrill  writes:

> On 05/01/2012 05:36 AM, Dodji Seketeli wrote:
>> pfile->context = XNEW (cpp_context);
>> +  memset (pfile->context, 0, sizeof (cpp_context));
>
> You can use XCNEW instead of XNEW + memset.
>
> OK with that change.

Thank you.

Here is the patch I will commit when Uros confirms that it fixes the
problem for him on alpha.

libcpp/

* directives.c (destringize_and_run): Properly initialize the new
context.
* macro.c (_cpp_pop_context): Assert that we shouldn't try to pop
the initial base context, which has the same life time as the
current instance of cpp_file.
---
 libcpp/directives.c |5 +
 libcpp/macro.c  |4 
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libcpp/directives.c b/libcpp/directives.c
index 0510c6e..e46280e 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1741,10 +1741,7 @@ destringize_and_run (cpp_reader *pfile, const cpp_string 
*in)
   saved_cur_token = pfile->cur_token;
   saved_cur_run = pfile->cur_run;
 
-  pfile->context = XNEW (cpp_context);
-  pfile->context->c.macro = 0;
-  pfile->context->prev = 0;
-  pfile->context->next = 0;
+  pfile->context = XCNEW (cpp_context);
 
   /* Inline run_directive, since we need to delay the _cpp_pop_buffer
  until we've read all of the tokens that we want.  */
diff --git a/libcpp/macro.c b/libcpp/macro.c
index ab3e8f6..c4e2a23 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -2152,6 +2152,10 @@ _cpp_pop_context (cpp_reader *pfile)
 {
   cpp_context *context = pfile->context;
 
+  /* We should not be popping the base context.  */
+  if (context == &pfile->base_context)
+abort ();
+
   if (context->c.macro)
 {
   cpp_hashnode *macro;
-- 
Dodji


[committed] Add -fno-sync-libcalls

2012-05-01 Thread Richard Henderson

A support option for implementing libatomic, committed as a separate patch.


r~
* common.opt (fsync-libcalls): New.
* doc/invoke.texi: Document it.
* optabs.c (init_sync_libfuncs): Honor it.


diff --git a/gcc/common.opt b/gcc/common.opt
index af02992..cc57976 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1878,6 +1878,10 @@ fstrict-overflow
 Common Report Var(flag_strict_overflow)
 Treat signed overflow as undefined
 
+fsync-libcalls
+Common Report Var(flag_sync_libcalls) Init(1)
+Implement __atomic operations via libcalls to legacy __sync functions
+
 fsyntax-only
 Common Report Var(flag_syntax_only)
 Check for syntax errors, then stop
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index a7efaa7..5550c71 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -990,7 +990,7 @@ See S/390 and zSeries Options.
 -fno-stack-limit -fsplit-stack @gol
 -fleading-underscore  -ftls-model=@var{model} @gol
 -ftrapv  -fwrapv  -fbounds-check @gol
--fvisibility -fstrict-volatile-bitfields}
+-fvisibility -fstrict-volatile-bitfields -fsync-libcalls}
 @end table
 
 @menu
@@ -19824,6 +19824,16 @@ that it is unaware of.
 The default value of this option is determined by the application binary
 interface for the target processor.
 
+@item -fsync-libcalls
+@opindex fsync-libcalls
+This option controls whether any out-of-line instance of the @code{__sync}
+family of functions may be used to implement the C++11 @code{__atomic}
+family of functions.
+
+The default value of this option is enabled, thus the only useful form
+of the option is @option{-fno-sync-libcalls}.  This option is used in
+the implementation of the @file{libatomic} runtime library.
+
 @end table
 
 @c man end
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 080061a..7ef513a 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -6643,6 +6643,9 @@ init_sync_libfuncs_1 (optab tab, const char *base, int 
max)
 void
 init_sync_libfuncs (int max)
 {
+  if (!flag_sync_libcalls)
+return;
+
   init_sync_libfuncs_1 (sync_compare_and_swap_optab,
"__sync_val_compare_and_swap", max);
   init_sync_libfuncs_1 (sync_lock_test_and_set_optab,


Re: [PATCH] Improve COND_EXPR expansion

2012-05-01 Thread Richard Henderson

On 04/30/2012 08:22 PM, Andrew Pinski wrote:

* expr.c (convert_tree_comp_to_rtx): New function.
(expand_expr_real_2): Try using conditional moves for COND_EXPRs if they exist.
* config/i386/i386.c (ix86_expand_int_movcc): Disallow comparison
modes of DImode for 32bits and TImode.


Looks ok, modulo some unwrapped long lines.
Those lines might not be so long if this were split out as a subroutine...

I'll not quibble about that though...


r~


Re: [C Patch]: pr52543

2012-05-01 Thread H.J. Lu
On Tue, May 1, 2012 at 7:46 AM, Richard Sandiford
 wrote:
> Ian Lance Taylor  writes:
>> Richard Sandiford  writes:
>>> Does anyone else have any thoughts before I make that change?
>>
>> I think that one of you should try to write a test case where it makes a
>> difference, and add the test case to the testsuite.
>
> I originally took that to mean a case where function vs. bb speed choices
> made a difference.  That isn't really possible as things stand because
> I don't know of any in-tree port that assigns different rtx costs to
> SETs based on the speed setting.
>
> But now I wonder whether you meant a test case where using rtx costs
> makes a difference.  I'm not really in a position to test ARM these days,
> but it sounds like any testcase for the VUNZP patch would cover this too,
> since it was this patch that prevented the VUNZP one from going in.
> I'll also try to come up with a MIPS testcase when I look at that
> (this weekend hopefully, but maybe not on recent form).
>
> Anyway, I modified the patch to use a per-function speed setting.
> After the off-list discussion between you and Kenny, I went ahead
> and applied it after retesting on x86_64-linux-gnu.
>
> To repeat: as things stand, very few targets define proper rtx costs
> for SET.  This patch is therefore expected to prevent lower-subreg
> from running in cases where it's actually benefical.  If you see that
> happening, please check whether the rtx_costs are defined properly.
>
> Of course, if the costs are defined properly and lower-subreg still
> makes the wrong choice, we need to look at why.
>
> Richard
>
>
> gcc/
> 2012-03-31  Kenneth Zadeck  
>            Richard Sandiford  
>
>        * Makefile.in (lower-subreg.o, target-globals.o): Depend on
>        lower-subreg.h.
>        * lower-subreg.h: New file.
>        * target-globals.h (this_target_lower_subreg): Declare.
>        (target_globals): Add lower_subreg;
>        (restore_target_globals): Restore this_target_lower_subreg.
>        * target-globals.c: Include it.
>        (default_target_globals): Add default_target_lower_subreg.
>        (save_target_globals): Initialize target_lower_subreg.
>        * rtl.h (init_lower_subreg): Added declaration.
>        * toplev.c (backend_init_target): Call initializer for lower-subreg
>        pass.
>        * lower-subreg.c (LOG_COSTS, FORCE_LOWERING): New macros.
>        (default_target_lower_subreg): New variable.
>        (this_target_lower_subreg): Likewise.
>        (twice_word_mode, choices): New macros.
>        (shift_cost, compute_splitting_shift, compute_costs)
>        (init_lower_subreg): New functions.
>        (resolve_simple_move): Add speed_p argument.  Check choices.
>        (find_pseudo_copy): Don't check the mode size here.
>        (resolve_simple_move): Assert the mode size.
>        (find_decomposable_shift_zext): Add speed_p argument and return
>        a bool.  Check choices.
>        (resolve_shift_zext): Add comment.
>        (dump_shift_choices, dump_choices): New functions.
>        (decompose_multiword_subregs): Dump list of profitable
>        transformations.  Add code to skip non profitable transformations.
>        Update calls to simple_move and find_decomposable_shift_zext.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53176

-- 
H.J.


Re: [PATCH] teach phi-opt to produce -(a COND b)

2012-05-01 Thread Richard Henderson

On 04/27/2012 03:01 AM, Paolo Bonzini wrote:

This patch teaches phiopt to look at phis whose arguments are -1 and 0,
and produce negated setcc statements.


Is this really a win over a COND_EXPR, i.e. (a < b ? -1 : 0)?

There is quite a bit of logic inside the rtl and backend expansion of
cmove that would seem to be being bypassed by committing to this form.


r~


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Jason Merrill

On 05/01/2012 08:00 AM, Paolo Carlini wrote:

I think either approach would be fine; I lean toward the first, but
changing the name and adding a flag for clarity. Changing the walking
behavior based on fn being null is too subtle.

Agreed. The below is what I booted and tested on x86_64-linux.



+   If ANY_P is true, return 1 if any, 0 otherwise.


This isn't really what the parameter means; it means also look into the 
types of declarations used in the expression.  So perhaps call it 
"check_types"?



+   If ANY_P is false, for each the iteration calls FN with the parameter
+   and the DATA.


This doesn't actually depend on ANY_P, it depends on whether or not FN 
is null.



  /* If there's no type, then this thing must be some expression
 involving template parameters.  */
  if (!fn && !TREE_TYPE (t))
return error_mark_node;


Hmm, this preexisting code seems to assume that any type-dependent 
expression must include a direct use of a template parameter, but it 
might just have a declaration with dependent type.  We should also test 
any_p/check_types, and this should apply to all expressions, not just these.



case MODOP_EXPR:
case CAST_EXPR:
case IMPLICIT_CONV_EXPR:
case REINTERPRET_CAST_EXPR:
case CONST_CAST_EXPR:
case STATIC_CAST_EXPR:
case DYNAMIC_CAST_EXPR:
case ARROW_EXPR:
case DOTSTAR_EXPR:
case TYPEID_EXPR:
case PSEUDO_DTOR_EXPR:
  if (!fn)
return error_mark_node;
  break;


This pre-existing code seems like it will do the wrong thing; these 
codes don't necessarily imply a dependent expression.  We can drop these 
cases, too.


Jason


Re: libgo patch committed: Fix build on MIPS GNU/Linux

2012-05-01 Thread Andrew Pinski
On Mon, Apr 30, 2012 at 10:28 AM, Ian Lance Taylor  wrote:
> This patch to libgo fixes the build on MIPS GNU/Linux.  I haven't been
> able to fully test gccgo, as the MIPS64 machine in the GCC compile farm
> is running a version of glibc that is too old--it does not support
> makecontext and friends.  However, this patch at least gets past the
> immediate build problem reported in PR 52586.  Bootstrapped and ran Go
> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and 4.7
> branch.

I tested the trunk after this patch on mips64-linux-gnu (with glibc
2.15) and the testsuite looks good.
=== go tests ===


Running target unix//-march=octeon+/-mabi=64
FAIL: go.test/test/nilptr.go execution,  -O2 -g

=== go Summary for unix//-march=octeon+/-mabi=64 ===

# of expected passes3291
# of unexpected failures1
# of expected failures  4
# of untested testcases 6

Running target unix//-march=octeon+/-mabi=n32
FAIL: go.test/test/nilptr.go execution,  -O2 -g

=== go Summary for unix//-march=octeon+/-mabi=n32 ===

# of expected passes3291
# of unexpected failures1
# of expected failures  4
# of untested testcases 6

Running target unix//-march=octeon2/-mabi=64
FAIL: go.test/test/nilptr.go execution,  -O2 -g

=== go Summary for unix//-march=octeon2/-mabi=64 ===

# of expected passes3291
# of unexpected failures1
# of expected failures  4
# of untested testcases 6

Running target unix//-march=octeon2/-mabi=n32
FAIL: go.test/test/nilptr.go execution,  -O2 -g

=== go Summary for unix//-march=octeon2/-mabi=n32 ===

# of expected passes3291
# of unexpected failures1
# of expected failures  4
# of untested testcases 6

=== go Summary ===

# of expected passes13164
# of unexpected failures4
# of expected failures  16
# of untested testcases 24
/home/apinski/src/gcc-fsf/local/gcc/objdir/gcc/testsuite/go/../../gccgo
 version 4.8.0 20120501 (experimental) [trunk revision 187009] (GCC)

=== libgo tests ===


Running target unix
FAIL: runtime
FAIL: net/http
FAIL: text/template

=== libgo Summary for unix ===

# of expected passes120
# of unexpected failures3

Running target unix/-mabi=64
FAIL: net/http

=== libgo Summary for unix/-mabi=64 ===

# of expected passes122
# of unexpected failures1

=== libgo Summary ===

# of expected passes242
# of unexpected failures4
/home/apinski/src/gcc-fsf/local/gcc/objdir/./gcc/gccgo version 4.8.0
20120501 (experimental) [trunk revision 187009] (GCC)


Thanks,
Andrew Pinski

>
> Ian
>


Re: libgo patch committed: Fix build on MIPS GNU/Linux

2012-05-01 Thread Ian Lance Taylor
Andrew Pinski  writes:

> I tested the trunk after this patch on mips64-linux-gnu (with glibc
> 2.15) and the testsuite looks good.

Thanks for testing.

> FAIL: go.test/test/nilptr.go execution,  -O2 -g

The nilptr.go test is known to fail on various targets.  Search for
nilptr in gcc/testsuite/go.test/go-test.exp.  Probably we just need to
add mips64 there.

>   === libgo tests ===
>
>
> Running target unix
> FAIL: runtime
> FAIL: net/http
> FAIL: text/template
>
>   === libgo Summary for unix ===
>
> # of expected passes  120
> # of unexpected failures  3



> Running target unix/-mabi=64
> FAIL: net/http
>
>   === libgo Summary for unix/-mabi=64 ===
>
> # of expected passes  122
> # of unexpected failures  1


I don't know what is going on with these failures.

Ian


Re: [PATCH] pr51020 Fix invalid options validation for ARM target

2012-05-01 Thread Alexey Kravets
On Mon, Apr 30, 2012 at 02:15:03PM +0100, Richard Earnshaw wrote:
> On 28/04/12 11:04, Alexey Kravets wrote:
> > Hi guys,
> > Please, take a look at this patch. It fixes the invalid star symbol
> > processing in validate_switches function reported in GCC bugzilla:
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51020
> > 
> > With this patch invalid options are no  longer accepted by the 
> > compiler (see new testcase for more details).
> > It showed no regressions on GCC-4.6.3 on ARM.
> > 
> > ChangeLog:
> >   * gcc/gcc.c(validate_switches): Reset starred flag.
> >   * gcc/testsuite/gcc.target/arm/pr51020.c: New test.
> > 
> 
> Why have you created an arm-specific test for something that, at least
> on initial examination, is a generic issue?
Yes, that is my bad. I have updated the test to be generic and rerun
testsuite on x86_64 machine (with no regressions). The updated patch is
attached.
> 
> R.
> 

-- 
Alexey Kravets
mr.kayr...@gmail.com
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 75f522e..e3c8609 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -7023,11 +7023,12 @@ validate_switches (const char *start)
   size_t len;
   int i;
   bool suffix = false;
-  bool starred = false;
+  bool starred;
 
 #define SKIP_WHITE() do { while (*p == ' ' || *p == '\t') p++; } while (0)
 
 next_member:
+  starred = false;
   SKIP_WHITE ();
 
   if (*p == '!')
diff --git a/gcc/testsuite/gcc.dg/pr51020.c b/gcc/testsuite/gcc.dg/pr51020.c
new file mode 100644
index 000..ac77dc1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr51020.c
@@ -0,0 +1,5 @@
+/* PR 51020 */
+/* { dg-do compile } */
+/* { dg-options "---" } */
+int main() {return 0;}
+/* { dg-error "unrecognized.*'---'" ""  { target *-*-* } 0 } */
-- 
1.7.5.4



signature.asc
Description: Digital signature


RFA (i386): PATCH to ix86_code_end to set DECL_IGNORED_P on the PC thunk

2012-05-01 Thread Jason Merrill
While working on another DWARF patch I ran into a crash because we 
didn't set DECL_IGNORED_P on the PC thunk, but we also don't emit any 
debug info for it.  Since there's no debug info, we should set 
DECL_IGNORED_P, and we shouldn't add ignored functions to .debug_aranges 
or .debug_ranges.


OK for trunk?
commit 1c8822f0eba9797ca937fd899c960a1b355d0563
Author: Jason Merrill 
Date:   Mon Apr 23 16:29:36 2012 -0400

	* config/i386/i386.c (ix86_code_end): Set DECL_IGNORED_P on the
	pc thunk.
	* dwarf2out.c (output_aranges): Skip DECL_IGNORED_P functions.
	(dwarf2out_finish): Likewise.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 903683e..43d8b8b 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -8612,6 +8612,7 @@ ix86_code_end (void)
    NULL_TREE, void_type_node);
   TREE_PUBLIC (decl) = 1;
   TREE_STATIC (decl) = 1;
+  DECL_IGNORED_P (decl) = 1;
 
 #if TARGET_MACHO
   if (TARGET_MACHO)
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 8bbf954..311914a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -8085,6 +8085,8 @@ output_aranges (unsigned long aranges_length)
 
   FOR_EACH_VEC_ELT (dw_fde_ref, fde_vec, fde_idx, fde)
 	{
+	  if (DECL_IGNORED_P (fde->decl))
+	continue;
 	  if (!fde->in_std_section)
 	{
 	  dw2_asm_output_addr (DWARF2_ADDR_SIZE, fde->dw_fde_begin,
@@ -21895,6 +21897,8 @@ dwarf2out_finish (const char *filename)
 
   FOR_EACH_VEC_ELT (dw_fde_ref, fde_vec, fde_idx, fde)
 	{
+	  if (DECL_IGNORED_P (fde->decl))
+	continue;
 	  if (!fde->in_std_section)
 	add_ranges_by_labels (comp_unit_die (), fde->dw_fde_begin,
   fde->dw_fde_end, &range_list_added);
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/thunk1.C b/gcc/testsuite/g++.dg/debug/dwarf2/thunk1.C
new file mode 100644
index 000..c34373e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/thunk1.C
@@ -0,0 +1,11 @@
+// Test that we don't add the x86 PC thunk to .debug_ranges
+// { dg-do compile { target i?86-*-* } }
+// { dg-options "-g -fpic" }
+// { dg-final { scan-assembler-times "LFB3" 1 } }
+
+template  void f(T t) { }
+
+int main()
+{
+  f(42);
+}


Re: RFA (i386): PATCH to ix86_code_end to set DECL_IGNORED_P on the PC thunk

2012-05-01 Thread Richard Henderson

On 05/01/2012 12:37 PM, Jason Merrill wrote:

* config/i386/i386.c (ix86_code_end): Set DECL_IGNORED_P on the
pc thunk.
* dwarf2out.c (output_aranges): Skip DECL_IGNORED_P functions.
(dwarf2out_finish): Likewise.


Ok.


r~


Put constant compound initializers in .rodata

2012-05-01 Thread Ian Lance Taylor
This patch to the C frontend and the middle-end puts constant compound
initializers in the readonly data section where possible.  This is for
PR 37303.  Bootstrapped and ran full testsuite on
x86_64-unknown-linux-gnu.

OK for mainline?

Ian


gcc/:

2012-05-01  Ian Lance Taylor  

PR c/37303
* c-decl.c (build_compound_literal): Make the decl readonly if it
an array of a readonly type.
* gimplify.c (gimplify_compound_literal_expr): Add fallback
parameter.  Change all callers.  If the decl is not addressable
and is not an l-value, make it readonly.

gcc/testsuite/:

2012-05-01  Ian Lance Taylor  

PR c/37303
* gcc.dg/pr37303.c: New test.


Index: gimplify.c
===
--- gimplify.c	(revision 187020)
+++ gimplify.c	(working copy)
@@ -3756,7 +3756,8 @@ rhs_predicate_for (tree lhs)
decl instead.  */
 
 static enum gimplify_status
-gimplify_compound_literal_expr (tree *expr_p, gimple_seq *pre_p)
+gimplify_compound_literal_expr (tree *expr_p, gimple_seq *pre_p,
+fallback_t fallback)
 {
   tree decl_s = COMPOUND_LITERAL_EXPR_DECL_EXPR (*expr_p);
   tree decl = DECL_EXPR_DECL (decl_s);
@@ -3775,6 +3776,12 @@ gimplify_compound_literal_expr (tree *ex
   && !needs_to_live_in_memory (decl))
 DECL_GIMPLE_REG_P (decl) = 1;
 
+  /* If the decl is not addressable, then it is being used in some
+ expression or on the right hand side of a statement, and it can
+ be put into a readonly data section.  */
+  if (!TREE_ADDRESSABLE (decl) && (fallback & fb_lvalue) == 0)
+TREE_READONLY (decl) = 1;
+
   /* This decl isn't mentioned in the enclosing block, so add it to the
  list of temps.  FIXME it seems a bit of a kludge to say that
  anonymous artificial vars aren't pushed, but everything else is.  */
@@ -7071,7 +7078,7 @@ gimplify_expr (tree *expr_p, gimple_seq 
 	  break;
 
 	case COMPOUND_LITERAL_EXPR:
-	  ret = gimplify_compound_literal_expr (expr_p, pre_p);
+	  ret = gimplify_compound_literal_expr (expr_p, pre_p, fallback);
 	  break;
 
 	case MODIFY_EXPR:
Index: c-decl.c
===
--- c-decl.c	(revision 187020)
+++ c-decl.c	(working copy)
@@ -4622,7 +4622,9 @@ build_compound_literal (location_t loc, 
   TREE_USED (decl) = 1;
   DECL_READ_P (decl) = 1;
   TREE_TYPE (decl) = type;
-  TREE_READONLY (decl) = TYPE_READONLY (type);
+  TREE_READONLY (decl) = (TYPE_READONLY (type)
+			  || (TREE_CODE (type) == ARRAY_TYPE
+			  && TYPE_READONLY (TREE_TYPE (type;
   store_init_value (loc, decl, init, NULL_TREE);
 
   if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
Index: testsuite/gcc.dg/pr37303.c
===
--- testsuite/gcc.dg/pr37303.c	(revision 0)
+++ testsuite/gcc.dg/pr37303.c	(revision 0)
@@ -0,0 +1,5 @@
+/* { dg-do compile { target *-*-elf* *-*-linux-gnu* } } */
+/* { dg-options "-std=c99" }
+/* { dg-final { scan-assembler "rodata" } } */
+
+struct S { const int *x; } s = { (const int[]){1, 2, 3} };


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Paolo Carlini

Hi,

On 05/01/2012 08:02 PM, Jason Merrill wrote:

On 05/01/2012 08:00 AM, Paolo Carlini wrote:

I think either approach would be fine; I lean toward the first, but
changing the name and adding a flag for clarity. Changing the walking
behavior based on fn being null is too subtle.

Agreed. The below is what I booted and tested on x86_64-linux.



+   If ANY_P is true, return 1 if any, 0 otherwise.


This isn't really what the parameter means; it means also look into 
the types of declarations used in the expression.  So perhaps call it 
"check_types"?

Ok.


+   If ANY_P is false, for each the iteration calls FN with the 
parameter

+   and the DATA.


This doesn't actually depend on ANY_P, it depends on whether or not FN 
is null.

Ok.



  /* If there's no type, then this thing must be some expression
 involving template parameters.  */
  if (!fn && !TREE_TYPE (t))
return error_mark_node;


Hmm, this preexisting code seems to assume that any type-dependent 
expression must include a direct use of a template parameter, but it 
might just have a declaration with dependent type.  We should also 
test any_p/check_types, and this should apply to all expressions, not 
just these.



case MODOP_EXPR:
case CAST_EXPR:
case IMPLICIT_CONV_EXPR:
case REINTERPRET_CAST_EXPR:
case CONST_CAST_EXPR:
case STATIC_CAST_EXPR:
case DYNAMIC_CAST_EXPR:
case ARROW_EXPR:
case DOTSTAR_EXPR:
case TYPEID_EXPR:
case PSEUDO_DTOR_EXPR:
  if (!fn)
return error_mark_node;
  break;


This pre-existing code seems like it will do the wrong thing; these 
codes don't necessarily imply a dependent expression.  We can drop 
these cases, too.
I'm not 100% sure to understand the last two comments. I'm removing 
completely the latter cases and changing the former like the below. Note 
that the way I handle fn in walk_template_parms implies that when 
check_types is true then pfd->fn is always NULL in  walk_template_parms_r.


The attached passes testing.

Paolo.




Index: cp/pt.c
===
--- cp/pt.c (revision 187012)
+++ cp/pt.c (working copy)
@@ -145,8 +145,8 @@ static tree convert_nontype_argument_function (tre
 static tree convert_nontype_argument (tree, tree, tsubst_flags_t);
 static tree convert_template_argument (tree, tree, tree,
   tsubst_flags_t, int, tree);
-static int for_each_template_parm (tree, tree_fn_t, void*,
-  struct pointer_set_t*, bool);
+static int walk_template_parms (tree, tree_fn_t, void*,
+   struct pointer_set_t*, bool, bool);
 static tree expand_template_argument_pack (tree);
 static tree build_template_parm_index (int, int, int, int, tree, tree);
 static bool inline_needs_template_parms (tree);
@@ -185,7 +185,7 @@ static int coerce_template_template_parms (tree, t
 static bool template_template_parm_bindings_ok_p (tree, tree);
 static int template_args_equal (tree, tree);
 static void tsubst_default_arguments (tree);
-static tree for_each_template_parm_r (tree *, int *, void *);
+static tree walk_template_parms_r (tree *, int *, void *);
 static tree copy_default_args_to_explicit_spec_1 (tree, tree);
 static void copy_default_args_to_explicit_spec (tree);
 static int invalid_nontype_parm_type_p (tree, tsubst_flags_t);
@@ -4276,8 +4276,8 @@ mark_template_parm (tree t, void* data)
   tpd->arg_uses_template_parms[tpd->current_arg] = 1;
 }
 
-  /* Return zero so that for_each_template_parm will continue the
- traversal of the tree; we want to mark *every* template parm.  */
+  /* Return zero so that walk_template_parms will continue the traversal
+ of the tree; we want to mark *every* template parm.  */
   return 0;
 }
 
@@ -4344,11 +4344,12 @@ process_partial_specialization (tree decl)
   for (i = 0; i < nargs; ++i)
 {
   tpd.current_arg = i;
-  for_each_template_parm (TREE_VEC_ELT (inner_args, i),
- &mark_template_parm,
- &tpd,
- NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (TREE_VEC_ELT (inner_args, i),
+  &mark_template_parm,
+  &tpd,
+  NULL,
+  /*check_types=*/false,
+  /*include_nondeduced_p=*/false);
 }
   for (i = 0; i < ntparms; ++i)
 if (tpd.parms[i] == 0)
@@ -4481,11 +4482,12 @@ process_partial_specialization (tree decl)
   tpd2.current_arg = i;
   tpd2.arg_uses_template_parms[i] = 0;
   memset (tpd2.parms, 0, sizeof (int) * nargs);
-  for_each_template_parm (type,
-  &mark_template_parm,
-  &tpd2,
-

[PATCH] configure.ac: Also quote '$' in tbaseargs

2012-05-01 Thread Maciej W. Rozycki
Hi,

 While working on some GDB changes I have stumbled across this, which 
looks like a buglet in the top-level configure.  Perhaps a three-way merge 
error from the past.  Unfortunately there is nothing in ChangeLog that 
would indicate when these bits were introduced.

 We have these two variables, $baseargs and $tbaseargs, that we handle 
almost identically, except some bits are omitted from $tbaseargs only, 
based on $skip_targ.  However, at the point we decide to quote '$' in any 
of the options collected we only do so for $baseargs.  As a result, '$' 
won't be escaped correctly in $tbaseargs and will break in sub-makes used 
for the target.  Have I missed anything?

 If not, then here's an obvious fix.  Found by inspection, I don't have a 
test case handy.  OK to apply?

2012-05-01  Maciej W. Rozycki  

* configure.ac: Also quote '$' in tbaseargs.
* configure: Regenerate.

  Maciej

gcc-ac-fix.diff
Index: gcc-fsf-trunk-quilt/configure
===
--- gcc-fsf-trunk-quilt.orig/configure  2012-05-01 20:44:33.995609891 +0100
+++ gcc-fsf-trunk-quilt/configure   2012-05-01 20:52:00.345564017 +0100
@@ -7267,6 +7267,7 @@ done
 # Remove the initial space we just introduced and, as these will be
 # expanded by make, quote '$'.
 baseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
+tbaseargs=`echo "x$tbaseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
 
 # Add in --program-transform-name, after --program-prefix and
 # --program-suffix have been applied to it.  Autoconf has already
Index: gcc-fsf-trunk-quilt/configure.ac
===
--- gcc-fsf-trunk-quilt.orig/configure.ac   2012-05-01 20:44:33.995609891 
+0100
+++ gcc-fsf-trunk-quilt/configure.ac2012-05-01 20:52:00.345564017 +0100
@@ -2721,6 +2721,7 @@ done
 # Remove the initial space we just introduced and, as these will be
 # expanded by make, quote '$'.
 baseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
+tbaseargs=`echo "x$tbaseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
 
 # Add in --program-transform-name, after --program-prefix and
 # --program-suffix have been applied to it.  Autoconf has already


Re: PR 53115

2012-05-01 Thread François Dumont
unordered_multilmap test added, attached patch applied to 4.7 branch and 
trunk.


This bug was not so difficult to fix. It would even have been quite easy 
to detect with a good test coverage tool showing that not all possible 
path had been tested in this method. I hope to be able to make some 
progress on this subject in the future. However I will have a try with 
Valgrind.


I can only add comment in bugzilla so I let you set this issue as resolved.

François


I will have a run with Valgrind

2012-05-01  François Dumont 

PR libstdc++/53115
* include/bits/hashtable.h
(_Hashtable<>::_M_rehash_aux(size_type, false_type)): Fix buckets
after insertion of several equivalent elements.
* testsuite/23_containers/unordered_multiset/insert/53115.cc: New.
* testsuite/23_containers/unordered_multimap/insert/53115.cc: New.
On 04/29/2012 12:42 PM, Paolo Carlini wrote:

On 04/29/2012 12:21 PM, François Dumont wrote:

Hi

Here is the patch for this PR. We were using buckets before 
updating them after having inserted equivalents elements one after 
the another.


2012-04-29  François Dumont 

PR libstdc++/53115
* include/bits/hashtable.h
(_Hashtable<>::_M_rehash_aux(size_type, false_type)): Fix buckets
after insertion of several equivalent elements.
* testsuite/23_containers/unordered_multiset/insert/53115.cc: New.

Tested undex linux x86_64 in the 4.7 branch, normal and debug mode.

Ok to commit ?
Ok, but please also add a similar testcase for unordered_multimap. 
Also - just in case isn't obvious enough - please run such testcases 
through valgrind.


Thanks!
Paolo.




Index: include/bits/hashtable.h
===
--- include/bits/hashtable.h	(revision 187022)
+++ include/bits/hashtable.h	(working copy)
@@ -1,6 +1,7 @@
 // hashtable.h header -*- C++ -*-
 
-// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -1670,57 +1671,55 @@
 
   while (__p)
 	{
-	  bool __check_now = true;
 	  _Node* __next = __p->_M_next();
 	  std::size_t __bkt = _HCBase::_M_bucket_index(__p, __n);
 
-	  if (!__new_buckets[__bkt])
+	  if (__prev_p && __prev_bkt == __bkt)
 	{
-	  __p->_M_nxt = _M_before_begin._M_nxt;
-	  _M_before_begin._M_nxt = __p;
-	  __new_buckets[__bkt] = &_M_before_begin;
-	  if (__p->_M_nxt)
-		__new_buckets[__bbegin_bkt] = __p;
-	  __bbegin_bkt = __bkt;
+	  // Previous insert was already in this bucket, we insert after
+	  // the previously inserted one to preserve equivalent elements
+	  // relative order.
+	  __p->_M_nxt = __prev_p->_M_nxt;
+	  __prev_p->_M_nxt = __p;
+	  
+	  // Inserting after a node in a bucket require to check that we
+	  // haven't change the bucket last node, in this case next
+	  // bucket containing its before begin node must be updated. We
+	  // schedule a check as soon as we move out of the sequence of
+	  // equivalent nodes to limit the number of checks.
+	  __check_bucket = true;
 	}
 	  else
 	{
-	  if (__prev_p && __prev_bkt == __bkt)
+	  if (__check_bucket)
 		{
-		  // Previous insert was already in this bucket, we insert after
-		  // the previously inserted one to preserve equivalent elements
-		  // relative order.
-		  __p->_M_nxt = __prev_p->_M_nxt;
-		  __prev_p->_M_nxt = __p;
-
-		  // Inserting after a node in a bucket require to check that we
-		  // haven't change the bucket last node, in this case next
-		  // bucket containing its before begin node must be updated. We
-		  // schedule a check as soon as we move out of the sequence of
-		  // equivalent nodes to limit the number of checks.
-		  __check_bucket = true;
-		  __check_now = false;
+		  // Check if we shall update the next bucket because of insertions
+		  // into __prev_bkt bucket.
+		  if (__prev_p->_M_nxt)
+		{
+		  std::size_t __next_bkt
+			= _HCBase::_M_bucket_index(__prev_p->_M_next(), __n);
+		  if (__next_bkt != __prev_bkt)
+			__new_buckets[__next_bkt] = __prev_p;
+		}
+		  __check_bucket = false;
 		}
+	  if (!__new_buckets[__bkt])
+		{
+		  __p->_M_nxt = _M_before_begin._M_nxt;
+		  _M_before_begin._M_nxt = __p;
+		  __new_buckets[__bkt] = &_M_before_begin;
+		  if (__p->_M_nxt)
+		__new_buckets[__bbegin_bkt] = __p;
+		  __bbegin_bkt = __bkt;
+		}
 	  else
 		{
 		  __p->_M_nxt = __new_buckets[__bkt]->_M_nxt;
 		  __new_buckets[__bkt]->_M_nxt = __p;
 		}
 	}
-	  
-	  if (__check_now && __check_bucket)
-	{
-	  // Check if we shall update the next bucket because of insertions
-	  // into __prev_bkt bucket.
-	  if (__prev_p->_M_nxt)
-		{
-		  std::size_t __next_bkt
-		= _HCBas

Re: PR 53115

2012-05-01 Thread Paolo Carlini

On 05/01/2012 10:23 PM, François Dumont wrote:
unordered_multilmap test added, attached patch applied to 4.7 branch 
and trunk.


This bug was not so difficult to fix. It would even have been quite 
easy to detect with a good test coverage tool showing that not all 
possible path had been tested in this method. I hope to be able to 
make some progress on this subject in the future. However I will have 
a try with Valgrind.
If you are on Linux, or any of the supported targets, *always* use 
valgrind when handling this kind of issue. If you are not, just let me 
know, and I will for you.


Paolo.



Re: [RFH / Patch] PR 51222

2012-05-01 Thread Paolo Carlini

On 05/01/2012 10:06 PM, Paolo Carlini wrote:
I'm not 100% sure to understand the last two comments. I'm removing 
completely the latter cases and changing the former like the below. 
Note that the way I handle fn in walk_template_parms implies that when 
check_types is true then pfd->fn is always NULL in  
walk_template_parms_r.
The below is a variant which uses pfd->check_types for INDIRECT_REF and 
COMPONENT_REF, consistently with other cases above and of course also works.


In fact, the reason why I'm still a bit confused about some of the cases 
of this switch, is that I'm not sure to understand what it could mean to 
call walk_template_parms with fn NULL and check_types false.


Paolo.


Index: cp/pt.c
===
--- cp/pt.c (revision 187012)
+++ cp/pt.c (working copy)
@@ -145,8 +145,8 @@ static tree convert_nontype_argument_function (tre
 static tree convert_nontype_argument (tree, tree, tsubst_flags_t);
 static tree convert_template_argument (tree, tree, tree,
   tsubst_flags_t, int, tree);
-static int for_each_template_parm (tree, tree_fn_t, void*,
-  struct pointer_set_t*, bool);
+static int walk_template_parms (tree, tree_fn_t, void*,
+   struct pointer_set_t*, bool, bool);
 static tree expand_template_argument_pack (tree);
 static tree build_template_parm_index (int, int, int, int, tree, tree);
 static bool inline_needs_template_parms (tree);
@@ -185,7 +185,7 @@ static int coerce_template_template_parms (tree, t
 static bool template_template_parm_bindings_ok_p (tree, tree);
 static int template_args_equal (tree, tree);
 static void tsubst_default_arguments (tree);
-static tree for_each_template_parm_r (tree *, int *, void *);
+static tree walk_template_parms_r (tree *, int *, void *);
 static tree copy_default_args_to_explicit_spec_1 (tree, tree);
 static void copy_default_args_to_explicit_spec (tree);
 static int invalid_nontype_parm_type_p (tree, tsubst_flags_t);
@@ -4276,8 +4276,8 @@ mark_template_parm (tree t, void* data)
   tpd->arg_uses_template_parms[tpd->current_arg] = 1;
 }
 
-  /* Return zero so that for_each_template_parm will continue the
- traversal of the tree; we want to mark *every* template parm.  */
+  /* Return zero so that walk_template_parms will continue the traversal
+ of the tree; we want to mark *every* template parm.  */
   return 0;
 }
 
@@ -4344,11 +4344,12 @@ process_partial_specialization (tree decl)
   for (i = 0; i < nargs; ++i)
 {
   tpd.current_arg = i;
-  for_each_template_parm (TREE_VEC_ELT (inner_args, i),
- &mark_template_parm,
- &tpd,
- NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (TREE_VEC_ELT (inner_args, i),
+  &mark_template_parm,
+  &tpd,
+  NULL,
+  /*check_types=*/false,
+  /*include_nondeduced_p=*/false);
 }
   for (i = 0; i < ntparms; ++i)
 if (tpd.parms[i] == 0)
@@ -4481,11 +4482,12 @@ process_partial_specialization (tree decl)
   tpd2.current_arg = i;
   tpd2.arg_uses_template_parms[i] = 0;
   memset (tpd2.parms, 0, sizeof (int) * nargs);
-  for_each_template_parm (type,
-  &mark_template_parm,
-  &tpd2,
-  NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (type,
+  &mark_template_parm,
+  &tpd2,
+  NULL,
+  /*check_types=*/false,
+  /*include_nondeduced_p=*/false);
 
   if (tpd2.arg_uses_template_parms [i])
 {
@@ -4755,7 +4757,7 @@ check_default_tmpl_args (tree decl, tree parms, in
 }
 
 /* Worker for push_template_decl_real, called via
-   for_each_template_parm.  DATA is really an int, indicating the
+   walk_template_parms.  DATA is really an int, indicating the
level of the parameters we are interested in.  If T is a template
parameter of that level, return nonzero.  */
 
@@ -7750,16 +7752,17 @@ struct pair_fn_data
 {
   tree_fn_t fn;
   void *data;
+  bool check_types;
   /* True when we should also visit template parameters that occur in
  non-deduced contexts.  */
   bool include_nondeduced_p;
   struct pointer_set_t *visited;
 };
 
-/* Called from for_each_template_parm via walk_tree.  */
+/* Called from walk_template_parms via walk_tree.  */
 
 static tree
-for_each_template_parm_r (tree *tp, i

Re: Backported r185231 from trunk. (issue 6139063)

2012-05-01 Thread asharif

On 2012/04/30 19:54:14, asharif wrote:

I backported the following patch:



2012-03-12  Richard Guenther  



* gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
* gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
(__gthread_mutex_init_function): New function.
* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.



PR gcov/49484
* libgcov.c: Include gthr.h.
(__gcov_flush_mx): New global variable.
(init_mx, init_mx_once): New functions.
(__gcov_flush): Protect self with a mutex.
(__gcov_fork): Re-initialize mutex after forking.
* unwind-dw2-fde.c: Change condition under which to use
__GTHREAD_MUTEX_INIT_FUNCTION.


Ping.

I did not see any degradation on internal benchmarks.


http://codereview.appspot.com/6139063/


Re: Backported r185231 from trunk. (issue 6139063)

2012-05-01 Thread davidxl

Ok for google branches (please also backport to google/gcc_47 branch.

David


On 2012/05/01 20:37:44, asharif wrote:

On 2012/04/30 19:54:14, asharif wrote:
> I backported the following patch:
>
> 2012-03-12  Richard Guenther  
>
>* gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
>* gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
>(__gthread_mutex_init_function): New function.
>* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
>
>PR gcov/49484
>* libgcov.c: Include gthr.h.
>(__gcov_flush_mx): New global variable.
>(init_mx, init_mx_once): New functions.
>(__gcov_flush): Protect self with a mutex.
>(__gcov_fork): Re-initialize mutex after forking.
>* unwind-dw2-fde.c: Change condition under which to use
>__GTHREAD_MUTEX_INIT_FUNCTION.



Ping.



I did not see any degradation on internal benchmarks.




http://codereview.appspot.com/6139063/


Re: Put constant compound initializers in .rodata

2012-05-01 Thread Richard Henderson

On 05/01/2012 01:05 PM, Ian Lance Taylor wrote:

2012-05-01  Ian Lance Taylor

PR c/37303
* c-decl.c (build_compound_literal): Make the decl readonly if it
an array of a readonly type.
* gimplify.c (gimplify_compound_literal_expr): Add fallback
parameter.  Change all callers.  If the decl is not addressable
and is not an l-value, make it readonly.

gcc/testsuite/:

2012-05-01  Ian Lance Taylor

PR c/37303
* gcc.dg/pr37303.c: New test.



Ok.


r~


Re: [Patch, fortran] PR41600 - [OOP] SELECT TYPE with associate-name => exp: Arrays not supported

2012-05-01 Thread Paul Richard Thomas
Dear Tobias, dear all,

Please accept my apologies for the long delay in responding to the
review.  A combination of overwhelming daytime works and a complete
failure of my workstation at home have knocked me out for the last six
weeks.

Find attached a revised patch to fix PR 41600.

On Sun, Mar 18, 2012 at 11:16 PM, Tobias Burnus  wrote:
> Dear Paul,
>
> thanks for the patch.
>
> Paul Richard Thomas wrote:
>>
>> + /* Transfer the selector typespec to the associate name.  */
>> +
>> + copy_ts_from_selector_to_associate (gfc_expr *expr1, gfc_expr *expr2)
>> + {
>
>  I think it is not obvious which type spec is which. Maybe you could add a
> "(expr1)" and "(expr2)"  in the comment. (Alternatively, one could rename
> expr1 and expr2.)

Done - expr1 and expr2 are re
>
>> +   if (expr2->ts.type == BT_CLASS
>> +       &&  CLASS_DATA (expr2)->as
>> +       &&  expr2->ref&&  expr2->ref->type == REF_ARRAY)
>> +     {
>> +       if (expr2->ref->u.ar.type == AR_FULL)
>> +       expr2->rank = CLASS_DATA (expr2)->as->rank;
>> +       else if (expr2->ref->u.ar.type == AR_SECTION)
>> +       expr2->rank = expr2->ref->u.ar.dimen;
>> +     }
>
>
> I have a bad feeling about that one for code like:
>  dt%class(1:2)
>  class%class(1:2)
>  dt(1:2)%class
>  class(1:2)%class
> I fear that at least one of those will fail. In any case, assuming that - if
> the last ref is BT_CLASS - the expr->ref is the right one, looks wrong. But
> I might have missed some fine print and it is guaranteed to be always the
> correct.

This has been improved to ensure that the references are correctly treated.

Note that array_ref%class is now excluded, except for scalars; see
select_type_28.f03
Select_type_27.f03 deals with class%array_ref

>

>> +   /* Logic is a LOT clearer with separate functions for class and
>> derived
>> +      type temporaries! There are not many more lines of code either.  */
>>     if (ts->type == BT_CLASS)
>> !     tmp = select_class_set_tmp (ts);
>> !   else
>> !     tmp = select_derived_set_tmp (ts);
>
>
> While I concur with the comment, I think one should remove it. As patch
> explanation it makes sense, but as committed it is not helpful.

Done

>
>>     gfc_add_type (tmp->n.sym, ts, NULL);
>>
>> ! /* Copy across the array spec to the selector, taking care as to
>> !    whether or not it is a class object or not.  */
>
>
> The indention looks wrong.

FIxed

>
>
>> (iii) The error that is thrown in resolve_assoc_var is necessary
>> because wrong code is produced at the moment since the size of the
>> declared type, rather than the dynamic type, is used for allocation of
>> the temporary.  The necessary machinery is in place to fix this and I
>> will do so soon
>
>
> I assume that's:
>>
>> !       gfc_error ("CLASS selector at %L needs a temporary which is not "
>> !                "yet implemented",&target->where);
>
>
> But I think one should also look into:
>>
>> !      TODO Understand why class scalar expressions must be excluded.  */
>> !   if (sym->assoc&&  !(sym->ts.type == BT_CLASS&&  e->rank == 0))

I still do not see this but undertake to fix/understand.

>
>
> Overall, the patch looks okay - I am just unsure about the expr2->ref usage
> in copy_ts_from_selector_to_associate.

Thanks for the review - I hope that the new version is satisfactory.

Cheers

Paul

See above.
2012-05-01  Paul Thomas  

PR fortran/41600
* trans-array.c (build_array_ref): New static function.
(gfc_conv_array_ref, gfc_get_dataptr_offset): Call it.
* trans-expr.c (gfc_get_vptr_from_expr): New function.
(gfc_conv_derived_to_class): Add a new argument for a caller
supplied vptr and use it if it is not NULL.
(gfc_conv_procedure_call): Add NULL to call to above.
symbol.c (gfc_is_associate_pointer): Return true if symbol is
a class object.
* trans-stmt.c (trans_associate_var): Handle class associate-
names.
* expr.c (gfc_get_variable_expr): Supply the array-spec if
possible.
* trans-types.c (gfc_typenode_for_spec): Set GFC_CLASS_TYPE_P
for class types.
* trans.h : Add prototypes for gfc_get_vptr_from_expr and
gfc_conv_derived_to_class. Define GFC_CLASS_TYPE_P.
* resolve.c (resolve_variable): For class arrays, ensure that
the target expression has all the necessary _data references.
(resolve_assoc_var): Throw a "not yet implemented" error for
class array selectors that need a temporary.
* match.c (copy_ts_from_selector_to_associate,
select_derived_set_tmp, select_class_set_tmp): New functions.
(select_type_set_tmp): Call one of last two new functions.
(gfc_match_select_type): Copy_ts_from_selector_to_associate is
called if associate-name is typed.

2012-05-01  Paul Thomas  

PR fortran/41600
* gfortran.dg/select_type_26.f03 : New test.
* gfortran.dg/select_type_27.f03 : New test.
* gfortran.dg/select_typ

Re: [PATCH] Take branch misprediction effects into account when RTL loop unrolling (issue 6099055)

2012-05-01 Thread Teresa Johnson
Fixed the stylist suggestions. Other responses below.

On Tue, Apr 24, 2012 at 10:22 PM,   wrote:
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c
> File loop-unroll.c (right):
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode156
> loop-unroll.c:156: static bool
> An empty line here.
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode182
> loop-unroll.c:182: static bool
> add empty line after comment.
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode213
> loop-unroll.c:213: /* Compute the number of branches in LOOP, weighted
> by execution counts.  */
> same here.
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode215
> loop-unroll.c:215: compute_weighted_branches(struct loop *loop)
> Missing space. Similarly for other functions.
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode255
> loop-unroll.c:255: data exists, simply return the current NUNROLL
> factor.  */
> same here.
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode281
> loop-unroll.c:281: while (loop_outer(outer))
> Should the check start from the current loop? Or the handling of the
> current loop should be peeled out -- max_unroll_factor =
> branch_budget/weighted_num_branches

Here we are trying to find a hot enclosing path, so we start from the
next most enclosing outer loop and walk outwards.

>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode317
> loop-unroll.c:317: return (PARAM_VALUE
> (PARAM_UNROLL_OUTER_LOOP_BRANCH_BUDGET) -
> The number of branches may be larger than budget --> leading to overflow
> -- need to guard against it.

Yes, this is a bug. I verified that it didn't have any real affect on
spec or internal benchmarks, thankfully, because in most cases where
there are more branches than the budget we have hit the outermost
(fake) loop and weren't executing this code. In the few cases we were,
we decided for other reasons not to unroll.

>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode318
> loop-unroll.c:318: weighted_outer_branches)/(weighted_num_branches - 1)
> + 1;
> Should it continue walking up the loop tree and find the minmal unroll
> factor?

Once we find a hot enough enclosing loop we stop, because the number
of iterations is large enough to assume that the nested branches will
train the predictor and also are relatively hot enough to make the
benefits of unrolling the innermost loop outweigh any negative impact
on the outer region's branch prediction.

New patch coming shortly.

Thanks,
Teresa

>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode747
> loop-unroll.c:747: && loop_has_FP_comp(loop)
> missing space
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode749
> loop-unroll.c:749: && desc->niter < (unsigned) PARAM_VALUE
> (PARAM_MIN_ITER_UNROLL_WITH_BRANCHES))
> line too long.
>
> http://codereview.appspot.com/6099055/diff/1/loop-unroll.c#newcode1057
> loop-unroll.c:1057: && loop_has_FP_comp(loop)
> Refactor the check into a helper function?
>
> http://codereview.appspot.com/6099055/diff/1/params.def
> File params.def (right):
>
> http://codereview.appspot.com/6099055/diff/1/params.def#newcode314
> params.def:314:
> Missing comment.
>
> http://codereview.appspot.com/6099055/diff/1/params.def#newcode319
> params.def:319:
> missing comment.
>
> http://codereview.appspot.com/6099055/



-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413


Re: Backported r185231 from trunk. (issue 6139063)

2012-05-01 Thread asharif

On 2012/05/01 20:44:05, davidxl wrote:

Ok for google branches (please also backport to google/gcc_47 branch.


Commited as r187026.

I'll backport to google/gcc-4_7 as well.



David




On 2012/05/01 20:37:44, asharif wrote:
> On 2012/04/30 19:54:14, asharif wrote:
> > I backported the following patch:
> >
> > 2012-03-12  Richard Guenther  
> >
> >   * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
> >   * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
> >   (__gthread_mutex_init_function): New function.
> >   * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
> >
> >   PR gcov/49484
> >   * libgcov.c: Include gthr.h.
> >   (__gcov_flush_mx): New global variable.
> >   (init_mx, init_mx_once): New functions.
> >   (__gcov_flush): Protect self with a mutex.
> >   (__gcov_fork): Re-initialize mutex after forking.
> >   * unwind-dw2-fde.c: Change condition under which to use
> >   __GTHREAD_MUTEX_INIT_FUNCTION.
>
> Ping.
>
> I did not see any degradation on internal benchmarks.



http://codereview.appspot.com/6139063/


[google-4_6] fix undefined typeinfo reference in LIPO (issue6149044)

2012-05-01 Thread Rong Xu
Hi,

This patch is for google-4_6 branch only.

It fixes a undefined type-info reference in LIPO compilation.

Tested with bootstrap, SPEC and internal benchmarks.

Thanks,

2012-05-01   Rong Xu  

* gcc/cp/rtti.c (get_tinfo_decl): generate tinfo for aux
modules in LIPO.

Index: gcc/cp/rtti.c
===
--- gcc/cp/rtti.c   (revision 186884)
+++ gcc/cp/rtti.c   (working copy)
@@ -443,8 +443,7 @@ get_tinfo_decl (tree type)
CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
 
   /* Add decl to the global array of tinfo decls.  */
-  if (!L_IPO_IS_AUXILIARY_MODULE)
-VEC_safe_push (tree, gc, unemitted_tinfo_decls, d);
+  VEC_safe_push (tree, gc, unemitted_tinfo_decls, d);
 }
 
   return d;

--
This patch is available for review at http://codereview.appspot.com/6149044


Re: [google-4_6] fix undefined typeinfo reference in LIPO (issue6149044)

2012-05-01 Thread Xinliang David Li
ok. Needs to be in google47 and google/main too.

David


On Tue, May 1, 2012 at 3:26 PM, Rong Xu  wrote:
> Hi,
>
> This patch is for google-4_6 branch only.
>
> It fixes a undefined type-info reference in LIPO compilation.
>
> Tested with bootstrap, SPEC and internal benchmarks.
>
> Thanks,
>
> 2012-05-01   Rong Xu  
>
>        * gcc/cp/rtti.c (get_tinfo_decl): generate tinfo for aux
>        modules in LIPO.
>
> Index: gcc/cp/rtti.c
> ===
> --- gcc/cp/rtti.c       (revision 186884)
> +++ gcc/cp/rtti.c       (working copy)
> @@ -443,8 +443,7 @@ get_tinfo_decl (tree type)
>        CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
>
>       /* Add decl to the global array of tinfo decls.  */
> -      if (!L_IPO_IS_AUXILIARY_MODULE)
> -        VEC_safe_push (tree, gc, unemitted_tinfo_decls, d);
> +      VEC_safe_push (tree, gc, unemitted_tinfo_decls, d);
>     }
>
>   return d;
>
> --
> This patch is available for review at http://codereview.appspot.com/6149044


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Jason Merrill

On 05/01/2012 04:06 PM, Paolo Carlini wrote:

Hmm, this preexisting code seems to assume that any type-dependent
expression must include a direct use of a template parameter, but it
might just have a declaration with dependent type. We should also test
any_p/check_types, and this should apply to all expressions, not just
these.



I'm not 100% sure to understand the last two comments.


I mean

if (check_types && !fn && !TYPE_P (t) && TREE_TYPE (t) == NULL_TREE)
  return error_mark_node.

instead of any cases for expressions.

Jason


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Jason Merrill

On 05/01/2012 04:32 PM, Paolo Carlini wrote:

In fact, the reason why I'm still a bit confused about some of the cases
of this switch, is that I'm not sure to understand what it could mean to
call walk_template_parms with fn NULL and check_types false.


It would mean to return non-null if there are any template arguments 
used directly in the expression.


Jason


Backported r185231 from trunk to google/gcc-4_7. (issue 6151043)

2012-05-01 Thread asharif

Reviewers: xur, davidxl,

Message:
Please take a look at this.

Description:
This fixes an issue with profile collection when multiple threads call
fork() around the same time.

2012-03-12  Richard Guenther  

* gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
* gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
(__gthread_mutex_init_function): New function.
* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.

PR gcov/49484
* libgcov.c: Include gthr.h.
(__gcov_flush_mx): New global variable.
(init_mx, init_mx_once): New functions.
(__gcov_flush): Protect self with a mutex.
(__gcov_fork): Re-initialize mutex after forking.
* unwind-dw2-fde.c: Change condition under which to use
__GTHREAD_MUTEX_INIT_FUNCTION.


Please review this at http://codereview.appspot.com/6151043/

Affected files:
   M.
  M libgcc/ChangeLog
  M libgcc/ChangeLog.google-4_7
  M libgcc/gthr-posix.h
  M libgcc/gthr-single.h
  M libgcc/gthr.h
  M libgcc/libgcov.c
  M libgcc/unwind-dw2-fde.c


Index: .
===
--- .   (revision 187027)
+++ .   (working copy)

Property changes on: .
___
Modified: svn:mergeinfo
   Merged /trunk:r185231
Index: libgcc/ChangeLog
===
--- libgcc/ChangeLog(revision 187027)
+++ libgcc/ChangeLog(working copy)
@@ -1,3 +1,19 @@
+2012-03-12  Richard Guenther  
+
+   * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
+   * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
+   (__gthread_mutex_init_function): New function.
+   * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
+
+   PR gcov/49484
+   * libgcov.c: Include gthr.h.
+   (__gcov_flush_mx): New global variable.
+   (init_mx, init_mx_once): New functions.
+   (__gcov_flush): Protect self with a mutex.
+   (__gcov_fork): Re-initialize mutex after forking.
+   * unwind-dw2-fde.c: Change condition under which to use
+   __GTHREAD_MUTEX_INIT_FUNCTION.
+
 2012-04-20  Thomas Schwinge  

struct siginfo vs. siginfo_t
Index: libgcc/ChangeLog.google-4_7
===
--- libgcc/ChangeLog.google-4_7 (revision 187027)
+++ libgcc/ChangeLog.google-4_7 (working copy)
@@ -1,3 +1,20 @@
+2012-05-01  Ahmad Sharif  
+   2012-03-12  Richard Guenther  
+
+   * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
+   * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
+   (__gthread_mutex_init_function): New function.
+   * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
+
+   PR gcov/49484
+   * libgcov.c: Include gthr.h.
+   (__gcov_flush_mx): New global variable.
+   (init_mx, init_mx_once): New functions.
+   (__gcov_flush): Protect self with a mutex.
+   (__gcov_fork): Re-initialize mutex after forking.
+   * unwind-dw2-fde.c: Change condition under which to use
+   __GTHREAD_MUTEX_INIT_FUNCTION.
+
 2012-04-17  Teresa Johnson  

Backport from google/main rev r186550
Index: libgcc/gthr-single.h
===
--- libgcc/gthr-single.h(revision 187027)
+++ libgcc/gthr-single.h(working copy)
@@ -36,6 +36,7 @@

 #define __GTHREAD_ONCE_INIT 0
 #define __GTHREAD_MUTEX_INIT 0
+#define __GTHREAD_MUTEX_INIT_FUNCTION (mx)
 #define __GTHREAD_RECURSIVE_MUTEX_INIT 0

 #define UNUSED __attribute__((unused))
Index: libgcc/libgcov.c
===
--- libgcc/libgcov.c(revision 187027)
+++ libgcc/libgcov.c(working copy)
@@ -48,6 +48,7 @@
 #include "tm.h"
 #endif /* __KERNEL__ */
 #include "libgcc_tm.h"
+#include "gthr.h"

 #if 1
 #define THREAD_PREFIX __thread
@@ -668,6 +669,25 @@
   info->version = 0;
 }

+#ifdef __GTHREAD_MUTEX_INIT
+ATTRIBUTE_HIDDEN __gthread_mutex_t __gcov_flush_mx = __GTHREAD_MUTEX_INIT;
+#define init_mx_once()
+#else
+__gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
+
+static void
+init_mx (void)
+{
+  __GTHREAD_MUTEX_INIT_FUNCTION (&mx);
+}
+static void
+init_mx_once (void)
+{
+  static __gthread_once_t once = __GTHREAD_ONCE_INIT;
+  __gthread_once (&once, init_mx);
+}
+#endif
+
 /* Called before fork or exec - write out profile information gathered so
far and reset it to zero.  This avoids duplication or loss of the
profile information gathered so far.  */
@@ -677,6 +697,9 @@
 {
   const struct gcov_info *gi_ptr;

+  init_mx_once ();
+  __gthread_mutex_lock (&__gcov_flush_mx);
+
   __gcov_stop_pmu_profiler ();
   gcov_exit ();
   for (gi_ptr = __gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
@@ -700,6 +723,7 @@
 }
 }
   __gcov_start_pmu_profiler ();
+  __gthread_mutex_unlock (&__

Re: Backported r185231 from trunk to google/gcc-4_7. (issue 6151043)

2012-05-01 Thread Xinliang David Li
ok.

David

On Tue, May 1, 2012 at 3:47 PM,   wrote:
> Reviewers: xur, davidxl,
>
> Message:
> Please take a look at this.
>
> Description:
> This fixes an issue with profile collection when multiple threads call
> fork() around the same time.
>
> 2012-03-12  Richard Guenther  
>
>        * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
>        * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
>        (__gthread_mutex_init_function): New function.
>        * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
>
>        PR gcov/49484
>        * libgcov.c: Include gthr.h.
>        (__gcov_flush_mx): New global variable.
>        (init_mx, init_mx_once): New functions.
>        (__gcov_flush): Protect self with a mutex.
>        (__gcov_fork): Re-initialize mutex after forking.
>        * unwind-dw2-fde.c: Change condition under which to use
>        __GTHREAD_MUTEX_INIT_FUNCTION.
>
>
> Please review this at http://codereview.appspot.com/6151043/
>
> Affected files:
>   M    .
>  M     libgcc/ChangeLog
>  M     libgcc/ChangeLog.google-4_7
>  M     libgcc/gthr-posix.h
>  M     libgcc/gthr-single.h
>  M     libgcc/gthr.h
>  M     libgcc/libgcov.c
>  M     libgcc/unwind-dw2-fde.c
>
>
> Index: .
> ===
> --- .   (revision 187027)
> +++ .   (working copy)
>
> Property changes on: .
> ___
> Modified: svn:mergeinfo
>   Merged /trunk:r185231
> Index: libgcc/ChangeLog
> ===
> --- libgcc/ChangeLog    (revision 187027)
> +++ libgcc/ChangeLog    (working copy)
> @@ -1,3 +1,19 @@
> +2012-03-12  Richard Guenther  
> +
> +       * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
> +       * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
> +       (__gthread_mutex_init_function): New function.
> +       * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
> +
> +       PR gcov/49484
> +       * libgcov.c: Include gthr.h.
> +       (__gcov_flush_mx): New global variable.
> +       (init_mx, init_mx_once): New functions.
> +       (__gcov_flush): Protect self with a mutex.
> +       (__gcov_fork): Re-initialize mutex after forking.
> +       * unwind-dw2-fde.c: Change condition under which to use
> +       __GTHREAD_MUTEX_INIT_FUNCTION.
> +
>  2012-04-20  Thomas Schwinge  
>
>        struct siginfo vs. siginfo_t
> Index: libgcc/ChangeLog.google-4_7
> ===
> --- libgcc/ChangeLog.google-4_7 (revision 187027)
> +++ libgcc/ChangeLog.google-4_7 (working copy)
> @@ -1,3 +1,20 @@
> +2012-05-01  Ahmad Sharif  
> +       2012-03-12  Richard Guenther  
> +
> +       * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification.
> +       * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
> +       (__gthread_mutex_init_function): New function.
> +       * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define.
> +
> +       PR gcov/49484
> +       * libgcov.c: Include gthr.h.
> +       (__gcov_flush_mx): New global variable.
> +       (init_mx, init_mx_once): New functions.
> +       (__gcov_flush): Protect self with a mutex.
> +       (__gcov_fork): Re-initialize mutex after forking.
> +       * unwind-dw2-fde.c: Change condition under which to use
> +       __GTHREAD_MUTEX_INIT_FUNCTION.
> +
>  2012-04-17  Teresa Johnson  
>
>        Backport from google/main rev r186550
> Index: libgcc/gthr-single.h
> ===
> --- libgcc/gthr-single.h        (revision 187027)
> +++ libgcc/gthr-single.h        (working copy)
> @@ -36,6 +36,7 @@
>
>  #define __GTHREAD_ONCE_INIT 0
>  #define __GTHREAD_MUTEX_INIT 0
> +#define __GTHREAD_MUTEX_INIT_FUNCTION (mx)
>  #define __GTHREAD_RECURSIVE_MUTEX_INIT 0
>
>  #define UNUSED __attribute__((unused))
> Index: libgcc/libgcov.c
> ===
> --- libgcc/libgcov.c    (revision 187027)
> +++ libgcc/libgcov.c    (working copy)
> @@ -48,6 +48,7 @@
>  #include "tm.h"
>  #endif /* __KERNEL__ */
>  #include "libgcc_tm.h"
> +#include "gthr.h"
>
>  #if 1
>  #define THREAD_PREFIX __thread
> @@ -668,6 +669,25 @@
>   info->version = 0;
>  }
>
> +#ifdef __GTHREAD_MUTEX_INIT
> +ATTRIBUTE_HIDDEN __gthread_mutex_t __gcov_flush_mx = __GTHREAD_MUTEX_INIT;
> +#define init_mx_once()
> +#else
> +__gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN;
> +
> +static void
> +init_mx (void)
> +{
> +  __GTHREAD_MUTEX_INIT_FUNCTION (&mx);
> +}
> +static void
> +init_mx_once (void)
> +{
> +  static __gthread_once_t once = __GTHREAD_ONCE_INIT;
> +  __gthread_once (&once, init_mx);
> +}
> +#endif
> +
>  /* Called before fork or exec - write out profile information gathered so
>    far and reset it to zero.  This avoids duplication or loss of the
>    profile information gathered so far.  */
> @@ -677,6 +697,9 @@
>  {
>   co

[PATCH] Take branch misprediction effects into account when RTL loop unrolling (issue6099055)

2012-05-01 Thread Teresa Johnson
Improved patch based on feedback. Main changes are:

1) Improve efficiency by caching loop analysis results in the loop auxiliary
info structure hanging off the loop structure. Renamed this structure from
niter_desc to loop_desc to reflect the broader type of information cached
in the structure. Added a new routine, analyze_loop_insns, to fill in
information about the average and total number of branches, as well
as whether there are any floating point set and call instructions in the loop.
The new routine is invoked when we first create a loop's loop_desc struct,
and the caller (get_simple_loop_desc) has been modified to handle creating
a loop_desc for the fake outermost loop.

2) Improvements to max_unroll_with_branches:
- Treat the fake outermost loop (the procedure body) as we would a hot outer
loop, i.e. compute the max unroll looking at its nested branches, instead of
shutting off unrolling when we reach the fake outermost loop.
- Pull the checks previously done in the caller into the routine (e.g.
whether the loop iterates frequently or contains fp instructions).
- Fix a bug in the previous version that sometimes caused overflow in the 
new unroll factor.

3) Remove float variables, and use integer computation to compute the
average number of branches in the loop.

4) Detect more types of floating point computations in the loop by walking
all set instructions, not just single sets.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  Ok for trunk?

Thanks,
Teresa

2012-05-01   Teresa Johnson  

* doc/invoke.texi: Update the documentation with new params.
* loop-unroll.c (max_unroll_with_branches): New function.
(loop_exit_at_end_p, decide_peel_once_rolling): Rename niter_desc
to loop_desc.
(decide_peel_completely, peel_loop_completely): Ditto.
(unroll_loop_runtime_iterations, decide_peel_simple): Ditto.
(peel_loop_simple, decide_unroll_stupid, unroll_loop_stupid): Ditto.
(decide_unroll_constant_iterations, decide_unroll_runtime_iterations):
Ditto, and add heuristic to avoid increasing branch mispredicts when
unrolling.
* loop-doloop.c (doloop_valid_p): Rename niter_desc to loop_desc.
(doloop_modify, doloop_optimize): Ditto.
* loop-iv.c (simplify_using_initial_values): Ditto.
(canonicalize_iv_subregs, determine_max_iter): Ditto.
(iv_number_of_iterations, check_simple_exit): Ditto.
(find_simple_exit, free_simple_loop_desc): Ditto.
(get_simple_loop_desc): Ditto, invoke new analyze_loop_insns
function, and add guards to enable this function to work for the
outermost loop.
* cfgloop.c (insn_has_fp_set, analyze_loop_insns): New functions.
* cfgloop.h (struct loop_desc): Renamed from struct niter_desc
and added new fields to cache additional loop analysis information.
(find_simple_exit, get_simple_loop_desc, simple_loop_desc): Rename
niter_desc to loop_desc.
(analyze_loop_insns): Declare.
* params.def (PARAM_MIN_ITER_UNROLL_WITH_BRANCHES): New param.
(PARAM_UNROLL_OUTER_LOOP_BRANCH_BUDGET): Ditto.


Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 187013)
+++ doc/invoke.texi (working copy)
@@ -8842,6 +8842,12 @@ The maximum number of insns of an unswitched loop.
 @item max-unswitch-level
 The maximum number of branches unswitched in a single loop.
 
+@item min-iter-unroll-with-branches
+Minimum iteration count to ignore branch effects when unrolling.
+
+@item unroll-outer-loop-branch-budget
+Maximum number of branches allowed in hot outer loop region after unroll.
+
 @item lim-expensive
 The minimum cost of an expensive expression in the loop invariant motion.
 
Index: loop-unroll.c
===
--- loop-unroll.c   (revision 187013)
+++ loop-unroll.c   (working copy)
@@ -152,6 +152,99 @@ static void combine_var_copies_in_loop_exit (struc
 basic_block);
 static rtx get_expansion (struct var_to_expand *);
 
+/* Compute the maximum number of times LOOP can be unrolled without exceeding
+   a branch budget, which can increase branch mispredictions. The number of
+   branches is computed by weighting each branch with its expected execution
+   probability through the loop based on profile data. If no profile feedback
+   data exists, simply return the current NUNROLL factor.  */
+
+static unsigned
+max_unroll_with_branches(struct loop *loop, unsigned nunroll)
+{
+  struct loop *outer;
+  struct loop_desc *outer_desc = 0;
+  int outer_niters = 1;
+  int frequent_iteration_threshold;
+  unsigned branch_budget;
+  struct loop_desc *desc = get_simple_loop_desc (loop);
+
+  /* Ignore loops with FP computation as these tend to benefit much more
+ consistently from unrolling.  */
+  if (desc->has_fp)
+return nunr

[patch] Update DWARF codes for Fission

2012-05-01 Thread Cary Coutant
This patch to include/dwarf2.def updates the DW_FORM and DW_AT codes
for the Fission extensions. We've eliminated DW_FORM_GNU_ref_index,
and replaced DW_AT_GNU_ref_base with DW_AT_GNU_ranges_base. (The wiki
page at http://gcc.gnu.org/wiki/DebugFission has been updated.)

OK for binutils and gcc?

-cary


include/

2012-05-01  Cary Coutant  

* dwarf2.def: Remove DW_FORM_GNU_ref_index,
replace DW_AT_GNU_ref_base with DW_AT_GNU_ranges_base.


commit bc45612d20fad44534b0efeeb821671d8e8c5b63
Author: Cary Coutant 
Date:   Tue May 1 16:08:08 2012 -0700

Update DW_FORM and DW_AT codes for Fission.

diff --git a/include/dwarf2.def b/include/dwarf2.def
index 3ac3354..e36ae91 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -203,7 +203,6 @@ DW_FORM (DW_FORM_exprloc, 0x18)
 DW_FORM (DW_FORM_flag_present, 0x19)
 DW_FORM (DW_FORM_ref_sig8, 0x20)
 /* Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFission.  */
-DW_FORM (DW_FORM_GNU_ref_index, 0x1f00)
 DW_FORM (DW_FORM_GNU_addr_index, 0x1f01)
 DW_FORM (DW_FORM_GNU_str_index, 0x1f02)
 DW_END_FORM
@@ -383,7 +382,7 @@ DW_AT (DW_AT_GNU_macros, 0x2119)
 /* Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFission.  */
 DW_AT (DW_AT_GNU_dwo_name, 0x2130)
 DW_AT (DW_AT_GNU_dwo_id, 0x2131)
-DW_AT (DW_AT_GNU_ref_base, 0x2132)
+DW_AT (DW_AT_GNU_ranges_base, 0x2132)
 DW_AT (DW_AT_GNU_addr_base, 0x2133)
 DW_AT (DW_AT_GNU_pubnames, 0x2134)
 DW_AT (DW_AT_GNU_pubtypes, 0x2135)


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Paolo Carlini

On 05/02/2012 12:39 AM, Jason Merrill wrote:

On 05/01/2012 04:06 PM, Paolo Carlini wrote:

Hmm, this preexisting code seems to assume that any type-dependent
expression must include a direct use of a template parameter, but it
might just have a declaration with dependent type. We should also test
any_p/check_types, and this should apply to all expressions, not just
these.



I'm not 100% sure to understand the last two comments.


I mean

if (check_types && !fn && !TYPE_P (t) && TREE_TYPE (t) == NULL_TREE)
  return error_mark_node.

instead of any cases for expressions.
Let's see if I got it right this time (I'm sorry, when a few days ago I 
noticed that we weren't tsubsting at all I thought the fix would be 
quite straightforward for me to handle because very local I didn't 
expect we would go ahead and resolve the FIXME about 
instantiation-dependent): we want to check for the above at the 
beginning of the function, like in the below. Indeed it works and allows 
me remove the check for TREE_TYPE in 
instantiation_dependent_expression_p, good.


Note, there is the minor subtlety with checking !fn explicitly: in my 
current patch it's redundant because I make sure in the caller that when 
check_types is true, any fn accidentally passed by upper caller as 
non-null is zeroed. This way, walk_template_parms_r can indeed do away 
with explicit checks for !fn when check_types is true or trust the users 
of walk_template_parms to make sure that fn is NULL together with 
check_types true (I don't think fn non-null together with check_types 
true makes any sense). I hope my explanation is clear enough ;) If you 
want me to handle this detail differently, just let know.


Paolo.

///
Index: cp/pt.c
===
--- cp/pt.c (revision 187012)
+++ cp/pt.c (working copy)
@@ -145,8 +145,8 @@ static tree convert_nontype_argument_function (tre
 static tree convert_nontype_argument (tree, tree, tsubst_flags_t);
 static tree convert_template_argument (tree, tree, tree,
   tsubst_flags_t, int, tree);
-static int for_each_template_parm (tree, tree_fn_t, void*,
-  struct pointer_set_t*, bool);
+static int walk_template_parms (tree, tree_fn_t, void*,
+   struct pointer_set_t*, bool, bool);
 static tree expand_template_argument_pack (tree);
 static tree build_template_parm_index (int, int, int, int, tree, tree);
 static bool inline_needs_template_parms (tree);
@@ -185,7 +185,7 @@ static int coerce_template_template_parms (tree, t
 static bool template_template_parm_bindings_ok_p (tree, tree);
 static int template_args_equal (tree, tree);
 static void tsubst_default_arguments (tree);
-static tree for_each_template_parm_r (tree *, int *, void *);
+static tree walk_template_parms_r (tree *, int *, void *);
 static tree copy_default_args_to_explicit_spec_1 (tree, tree);
 static void copy_default_args_to_explicit_spec (tree);
 static int invalid_nontype_parm_type_p (tree, tsubst_flags_t);
@@ -4276,8 +4276,8 @@ mark_template_parm (tree t, void* data)
   tpd->arg_uses_template_parms[tpd->current_arg] = 1;
 }
 
-  /* Return zero so that for_each_template_parm will continue the
- traversal of the tree; we want to mark *every* template parm.  */
+  /* Return zero so that walk_template_parms will continue the traversal
+ of the tree; we want to mark *every* template parm.  */
   return 0;
 }
 
@@ -4344,11 +4344,12 @@ process_partial_specialization (tree decl)
   for (i = 0; i < nargs; ++i)
 {
   tpd.current_arg = i;
-  for_each_template_parm (TREE_VEC_ELT (inner_args, i),
- &mark_template_parm,
- &tpd,
- NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (TREE_VEC_ELT (inner_args, i),
+  &mark_template_parm,
+  &tpd,
+  NULL,
+  /*check_types=*/false,
+  /*include_nondeduced_p=*/false);
 }
   for (i = 0; i < ntparms; ++i)
 if (tpd.parms[i] == 0)
@@ -4481,11 +4482,12 @@ process_partial_specialization (tree decl)
   tpd2.current_arg = i;
   tpd2.arg_uses_template_parms[i] = 0;
   memset (tpd2.parms, 0, sizeof (int) * nargs);
-  for_each_template_parm (type,
-  &mark_template_parm,
-  &tpd2,
-  NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (type,
+  &mark_template_parm,
+  &tpd2,
+  NULL,
+  /*

Re: [RFH / Patch] PR 51222

2012-05-01 Thread Paolo Carlini

On 05/02/2012 01:27 AM, Paolo Carlini wrote:
Note, there is the minor subtlety with checking !fn explicitly: in my 
current patch it's redundant because I make sure in the caller that 
when check_types is true, any fn accidentally passed by upper caller 
as non-null is zeroed. This way, walk_template_parms_r can indeed do 
away with explicit checks for !fn when check_types is true or trust 
the users of walk_template_parms to make sure that fn is NULL together 
with check_types true (I don't think fn non-null together with 
check_types true makes any sense). I hope my explanation is clear 
enough ;) If you want me to handle this detail differently, just let 
know.
Maybe we want to gcc_assert ((check_types && !fn) || !check_types) at 
the beginning of walk_template_parms. I don't know.


Paolo.


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Jason Merrill

On 05/01/2012 07:39 PM, Paolo Carlini wrote:

I'm sorry, when a few days ago I noticed that we weren't tsubsting at all I 
thought the fix would be quite straightforward for me to handle because very 
local I didn't expect we would go ahead and resolve the FIXME about 
instantiation-dependent


No worries, thanks for sticking with it.


Maybe we want to gcc_assert ((check_types && !fn) || !check_types) at
the beginning of walk_template_parms. I don't know.


!check_types || !fn, sounds good.


+  if (pfd->check_types && !TYPE_P (t) && TREE_TYPE (t) == NULL_TREE)
+return error_mark_node;


Let's add a comment like: if the type is null, this is a type-dependent 
expression, and if we're checking types, we would find the relevant 
template parameters. And fn must be null, so we can just return.


I think we need to handle FIELD_DECL, too.

Jason


Re: User directed Function Multiversioning via Function Overloading (issue5752064)

2012-05-01 Thread H.J. Lu
On Tue, May 1, 2012 at 4:51 PM, Sriraman Tallam  wrote:
> Hi,
>
> New patch attached, updated test case and fixed bugs related to
> __PRETTY_FUNCTION_.
>
> Patch also available for review here:  http://codereview.appspot.com/5752064

@@ -0,0 +1,39 @@
+/* Simple test case to check if Multiversioning works.  */
+/* { dg-do run } */
+/* { dg-options "-O2 -fPIC" } */
+
+#include 
+
+int foo ();
+int foo () __attribute__ ((target("arch=corei7,sse4.2,popcnt")));
+/* The target operands in this declaration and the definition are re-ordered.
+   This should still work.  */
+int foo () __attribute__ ((target("ssse3,avx2")));
+
+int (*p)() = &foo;
+int main ()
+{
+  return foo () + (*p)();
+}
+
+int foo ()
+{
+  return 0;
+}
+
+int __attribute__ ((target("arch=corei7,sse4.2,popcnt")))
+foo ()
+{
+  assert (__builtin_cpu_is ("corei7")
+ && __builtin_cpu_supports ("sse4.2")
+ && __builtin_cpu_supports ("popcnt"));
+  return 0;
+}
+
+int __attribute__ ((target("avx2,ssse3")))
+foo ()
+{
+  assert (__builtin_cpu_supports ("avx2")
+ && __builtin_cpu_supports ("ssse3"));
+  return 0;
+}

This test will pass if

int foo ()
{
 return 0;
}

is selected on processors with AVX.  The run-time test should
check that the right function is selected on the target processor,
not the selected function matches the target attribute. You can
do it by returning different values for each foo and call cpuid
to check if the right foo is selected.

You should add a testcase for __builtin_cpu_supports to check
all valid arguments.

-- 
H.J.


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Paolo Carlini

Hi,

On 05/02/2012 01:46 AM, Jason Merrill wrote:

On 05/01/2012 07:39 PM, Paolo Carlini wrote:
I'm sorry, when a few days ago I noticed that we weren't tsubsting at 
all I thought the fix would be quite straightforward for me to handle 
because very local I didn't expect we would go ahead and resolve the 
FIXME about instantiation-dependent


No worries, thanks for sticking with it.


Maybe we want to gcc_assert ((check_types && !fn) || !check_types) at
the beginning of walk_template_parms. I don't know.


!check_types || !fn, sounds good.

Indeed ;)



+  if (pfd->check_types && !TYPE_P (t) && TREE_TYPE (t) == NULL_TREE)
+return error_mark_node;


Let's add a comment like: if the type is null, this is a 
type-dependent expression, and if we're checking types, we would find 
the relevant template parameters. And fn must be null, so we can just 
return.

Ok. I'm attaching below the "state of the art".


I think we need to handle FIELD_DECL, too.
Are there hopes that handling FIELD_DECL like FUNCTION_DECL and VAR_DECL 
(besides the DECL_LANG_SPECIFIC check) would work? Ie;


case FIELD_DECL:
  if (DECL_TEMPLATE_INFO (t)
&& walk_template_parms (DECL_TI_ARGS (t), fn, data,
  pfd->visited, pfd->check_types,
  pfd->include_nondeduced_p))
return error_mark_node;

Unfortunately I don't see anything explicit about FIELD_DECL in the 
various dependent_p things, no hints.


Thanks,
Paolo.




Index: cp/pt.c
===
--- cp/pt.c (revision 187012)
+++ cp/pt.c (working copy)
@@ -145,8 +145,8 @@ static tree convert_nontype_argument_function (tre
 static tree convert_nontype_argument (tree, tree, tsubst_flags_t);
 static tree convert_template_argument (tree, tree, tree,
   tsubst_flags_t, int, tree);
-static int for_each_template_parm (tree, tree_fn_t, void*,
-  struct pointer_set_t*, bool);
+static int walk_template_parms (tree, tree_fn_t, void*,
+   struct pointer_set_t*, bool, bool);
 static tree expand_template_argument_pack (tree);
 static tree build_template_parm_index (int, int, int, int, tree, tree);
 static bool inline_needs_template_parms (tree);
@@ -185,7 +185,7 @@ static int coerce_template_template_parms (tree, t
 static bool template_template_parm_bindings_ok_p (tree, tree);
 static int template_args_equal (tree, tree);
 static void tsubst_default_arguments (tree);
-static tree for_each_template_parm_r (tree *, int *, void *);
+static tree walk_template_parms_r (tree *, int *, void *);
 static tree copy_default_args_to_explicit_spec_1 (tree, tree);
 static void copy_default_args_to_explicit_spec (tree);
 static int invalid_nontype_parm_type_p (tree, tsubst_flags_t);
@@ -4276,8 +4276,8 @@ mark_template_parm (tree t, void* data)
   tpd->arg_uses_template_parms[tpd->current_arg] = 1;
 }
 
-  /* Return zero so that for_each_template_parm will continue the
- traversal of the tree; we want to mark *every* template parm.  */
+  /* Return zero so that walk_template_parms will continue the traversal
+ of the tree; we want to mark *every* template parm.  */
   return 0;
 }
 
@@ -4344,11 +4344,12 @@ process_partial_specialization (tree decl)
   for (i = 0; i < nargs; ++i)
 {
   tpd.current_arg = i;
-  for_each_template_parm (TREE_VEC_ELT (inner_args, i),
- &mark_template_parm,
- &tpd,
- NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (TREE_VEC_ELT (inner_args, i),
+  &mark_template_parm,
+  &tpd,
+  NULL,
+  /*check_types=*/false,
+  /*include_nondeduced_p=*/false);
 }
   for (i = 0; i < ntparms; ++i)
 if (tpd.parms[i] == 0)
@@ -4481,11 +4482,12 @@ process_partial_specialization (tree decl)
   tpd2.current_arg = i;
   tpd2.arg_uses_template_parms[i] = 0;
   memset (tpd2.parms, 0, sizeof (int) * nargs);
-  for_each_template_parm (type,
-  &mark_template_parm,
-  &tpd2,
-  NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (type,
+  &mark_template_parm,
+  &tpd2,
+  NULL,
+  /*check_types=*/false,
+  /*include_nondeduced_p=*/false);
 
   if (tpd2.arg_uses_template_parms [i])
 {
@@ -4755,7 +4757,7 @@ check_default_tmpl_args (tree decl,

[0/6] Fold prev/next into gimple

2012-05-01 Thread Michael Matz
Hi,

a long time ago, during development of [tuples] gimple_statement_base had 
prev/next links.  Those were moved to gimple_seq_node, referred to from 
gimple_seq, and referring to gimple statements, on the grounds that this 
eases experimentation with different data structures.  Well, those 
experiments never happened, and meanwhile we still suffer cache thrashing 
and memory waste due to that setup.  See also 
http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00794.html and the up/down 
thread discussions there.

We observe:
* every gimple is in a sequence (except for very short intermediate 
  times), hence there's a gimple_seq_node for every gimple.  It has three 
  pointers (prev/next/stmt).
* a gimple_seq is also three pointers (head/tail/freelist)
* allocation/deallocation of gimple_seq is optimized in a peculiar way, 
  via a free list, which is strange because gimple_seq_node (which are 
  allocated much more often than gimple_seq, necessarily so, because
  there's at least one node for every non-empty seq) are not optimized
  this way
* most gimple statements are member of _at most_ one sequence, and where
  this isn't the case it's easy to shuffle the code a bit to make it so.
  I.e. the facility that multiple nodes could point to the same gimple 
  aren't really necessary.
* there's no easy stmt to node mapping, hence gsi_for_stmt is O(n)

So, let's reshuffle everything like so:
* ensure gimples are in exactly one sequence always
* make gimple be the node itself (include a prev/next pair), getting rid
  of one pointer per gimple
* make gimple also be a seq itself (getting rid of the freelist and three 
  pointers per sequence; I haven't measured how many there are)

The latter will be achieved by cleverly using the prev pointer of the 
first gimple statement in a sequence (which would be NULL with the 
traditional NIL-ended lists) as pointer to the last statement of the whole 
sequence.  A consequence will be that the prev links form a cyclic list.  
The next links will still be a traditional NULL-ended one.  The latter is 
good because so we can easily detect the last element of a sequence 
(->next is NULL) from the element itself, and hence also the first element 
(->prev->next is NULL).  Via this we could improve a bit on iterators in 
some circumstances.

So, after these changes a gimple_seq doesn't need to be allocated anymore, 
it will either be NULL (an empty seq) or be a gimple statement itself (the 
first of that very seq).

The patch series as replies to this mail implements the above.  It will 
not go over the whole compiler and do a s/gimple_seq_node/gimple/ and 
s/gimple_seq/gimple/, i.e. we retain the possibility to implement those 
types in some other ways in the future.  E.g. the functions in 
gimple-iterator.c will continue to talk about gimple_seq_node, as well as 
gimple.h functions dealing with gimple_seq (some will take a pointer to a 
seq, not the seq itself anymore).  But they will merely by typedefs to 
gimple.

I'll say that this split into six parts was done after I've written the 
bulk of the thing already.  Hence the individual parts are _not_ 
bootstrapped and regtested, I only made sure that tree-ssa.exp (for C and 
C++) works for every patch in sequence.  The whole series together is 
regstrapped on x86_64-linux (all languages, plus Ada, objc++) without 
regressions.  Therefore I consider applying only the whole series as one 
commit to not break regression hunters, i.e. the split is rather for 
reviewing pleasure.

Now, as for measurements.  With an unpatched and a patched compiler, both 
compiled with -O2 by my system compiler (i.e. not bootstrapped), with some 
largish testcases, time and memory:

   unpatchedpatched
   time GCmemmaxmem time  GCmemmaxmem
kdecore.cc 114.05s  948770k  313093k108.76s   940860k  307865k
big-code.c  60.63s  324343k  159477k 53.73s   321635k  157941k

So, max memory improves by 1% to 2% (GCmem is the added overall garbage 
collected memory), and compile time by 5% to 10% (!).  Note that I haven't 
configured that compiler with disable-checking (though I _added_ some 
asserts :) ).  I have lost my bootstrap time numbers meanwhile, but 
bootstrap time with patch improved by only 1%, but still measurable.

So, looking forward to approvals/comments for the patches.


Ciao,
Michael.


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Paolo Carlini

On 05/02/2012 01:46 AM, Jason Merrill wrote:

I think we need to handle FIELD_DECL, too.
A data point I can give you, I put a gcc_assert (TREE_CODE (t) != 
FIELD_DECL) in the default case of the walk_template_parms_r switch, and 
it never triggers for the whole testsuite.


Paolo.


[2/6] Fold prev/next into gimple: fewer gimple_seq_alloc calls

2012-05-01 Thread Michael Matz
Hi,

This patch gets rid of some easy gimple_seq_alloc calls that we don't even 
need currently because most gimple_seq modifier will lazily allocate one.  
Most of the time it's enough to simply initialize a seq to NULL and call 
the respective routines like gimple_seq_add_{stmt,seq}.  (A notable 
exception is when the seq will be used in an iterator).

As per [0/6] regstrapped together with the other five patches on 
x86_64-linux.  Okay for trunk?


Ciao,
Michael.

2012-05-02  Michael Matz  

* tree-phinodes.c (add_phi_node_to_bb): Tidy, don't use
gimple_seq_alloc.
* omp-low.c (finalize_task_copyfn): Don't use gimple_seq_alloc.
* tree-nested.c (walk_gimple_omp_for): Ditto.
* trans-mem.c (lower_transaction): Ditto.
* tree-eh.c (do_return_redirection): Ditto.
(do_goto_redirection): Ditto.
(lower_try_finally_switch): Ditto.
* gimplify.c (gimplify_stmt): Ditto.
(gimplify_scan_omp_clauses): Ditto.
(gimplify_omp_for): Ditto.
(gimplify_function_tree): Ditto.
* gimple-fold.c (gimplify_and_update_call_from_tree): Ditto.
* tree-mudflap.c (mf_decl_cache_locals): Ditto.
(mf_build_check_statement_for): Ditto.
(mx_register_decls): Ditto.
* graphite-sese-to-poly.c (remove_invariant_phi): Ditto,
and don't use itertors to append.
(insert_stmts): Ditto.
(insert_out_of_ssa_copy): Ditto.
(insert_out_of_ssa_copy_on_edge): Ditto.

Index: tree-phinodes.c
===
*** tree-phinodes.c.orig2012-05-01 22:43:34.0 +0200
--- tree-phinodes.c 2012-05-01 22:43:55.0 +0200
*** reserve_phi_args_for_new_edge (basic_blo
*** 356,368 
  void
  add_phi_node_to_bb (gimple phi, basic_block bb)
  {
!   gimple_stmt_iterator gsi;
/* Add the new PHI node to the list of PHI nodes for block BB.  */
!   if (phi_nodes (bb) == NULL)
! set_phi_nodes (bb, gimple_seq_alloc ());
! 
!   gsi = gsi_last (phi_nodes (bb));
!   gsi_insert_after (&gsi, phi, GSI_NEW_STMT);
  
/* Associate BB to the PHI node.  */
gimple_set_bb (phi, bb);
--- 356,370 
  void
  add_phi_node_to_bb (gimple phi, basic_block bb)
  {
!   gimple_seq seq = phi_nodes (bb);
/* Add the new PHI node to the list of PHI nodes for block BB.  */
!   if (seq == NULL)
! set_phi_nodes (bb, gimple_seq_alloc_with_stmt (phi));
!   else
! {
!   gimple_seq_add_stmt (&seq, phi);
!   gcc_assert (seq == phi_nodes (bb));
! }
  
/* Associate BB to the PHI node.  */
gimple_set_bb (phi, bb);
Index: omp-low.c
===
*** omp-low.c.orig  2012-05-01 22:43:34.0 +0200
--- omp-low.c   2012-05-01 22:43:55.0 +0200
*** finalize_task_copyfn (gimple task_stmt)
*** 1231,1237 
  {
struct function *child_cfun;
tree child_fn, old_fn;
!   gimple_seq seq, new_seq;
gimple bind;
  
child_fn = gimple_omp_task_copy_fn (task_stmt);
--- 1231,1237 
  {
struct function *child_cfun;
tree child_fn, old_fn;
!   gimple_seq seq = NULL, new_seq;
gimple bind;
  
child_fn = gimple_omp_task_copy_fn (task_stmt);
*** finalize_task_copyfn (gimple task_stmt)
*** 1248,1260 
push_cfun (child_cfun);
current_function_decl = child_fn;
bind = gimplify_body (child_fn, false);
-   seq = gimple_seq_alloc ();
gimple_seq_add_stmt (&seq, bind);
new_seq = maybe_catch_exception (seq);
if (new_seq != seq)
  {
bind = gimple_build_bind (NULL, new_seq, NULL);
!   seq = gimple_seq_alloc ();
gimple_seq_add_stmt (&seq, bind);
  }
gimple_set_body (child_fn, seq);
--- 1248,1259 
push_cfun (child_cfun);
current_function_decl = child_fn;
bind = gimplify_body (child_fn, false);
gimple_seq_add_stmt (&seq, bind);
new_seq = maybe_catch_exception (seq);
if (new_seq != seq)
  {
bind = gimple_build_bind (NULL, new_seq, NULL);
!   seq = NULL;
gimple_seq_add_stmt (&seq, bind);
  }
gimple_set_body (child_fn, seq);
Index: tree-nested.c
===
*** tree-nested.c.orig  2012-05-01 22:43:34.0 +0200
--- tree-nested.c   2012-05-01 22:43:55.0 +0200
*** walk_gimple_omp_for (gimple for_stmt,
*** 617,623 
  
walk_body (callback_stmt, callback_op, info, gimple_omp_for_pre_body_ptr 
(for_stmt));
  
!   seq = gimple_seq_alloc ();
memset (&wi, 0, sizeof (wi));
wi.info = info;
wi.gsi = gsi_last (seq);
--- 617,623 
  
walk_body (callback_stmt, callback_op, info, gimple_omp_for_pre_body_ptr 
(for_stmt));
  
!   seq = NULL;
memset (&wi, 0, sizeof (wi));
wi.info = info;
wi.gsi = gsi_last (seq);
*** walk_gimple_omp_for (gimple for_stmt,
*** 646,654 
walk_t

[3/6] Fold prev/next into gimple

2012-05-01 Thread Michael Matz
Hi,

this introduces a new helper (gsi_replace_with_seq) which can replace a 
single statement with a sequence, and makes use of it in 
gimplify_and_update_call_from_tree.  This make sure that the statements 
aren't inserted into the target sequence while they still are in the 
original one.  Could also be solved by gsi_removing them just before 
inserting them, but this way seems much nicer.

The tree-ssa-forwprop.c hunk ensures that when we remove the statement 
that the iterator (in the caller) pointing to it isn't invalidated.  I 
think this was from earlier experiments of how to represent the data 
structures and might not be strictly needed anymore, but I've always 
tested with it, and it's definitely not harmful.

As per [0/6] regstrapped with the other five on x86_64-linux.  Okay for 
trunk?


Ciao,
Michael.
--
2012-05-02  Michael Matz  

* gimple-fold.c (gimplify_and_update_call_from_tree): Use
gsi_replace_with_seq, instead of inserting itself.
* gimple-iterator.c (gsi_replace_with_seq): New function.
* tree-ssa-forwprop.c (forward_propagate_comparison): Take
iterator instead of statement, advance it.
(ssa_forward_propagate_and_combine): Adjust call to above.

Index: gimple-fold.c
===
*** gimple-fold.c.orig  2012-05-01 22:44:02.0 +0200
--- gimple-fold.c   2012-05-01 22:44:06.0 +0200
*** gimplify_and_update_call_from_tree (gimp
*** 551,557 
gimple_stmt_iterator i;
gimple_seq stmts = NULL;
struct gimplify_ctx gctx;
-   gimple last;
gimple laststore;
tree reaching_vuse;
  
--- 551,556 
*** gimplify_and_update_call_from_tree (gimp
*** 620,636 
  
/* Second iterate over the statements forward, assigning virtual
   operands to their uses.  */
-   last = NULL;
reaching_vuse = gimple_vuse (stmt);
for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i))
  {
-   /* Do not insert the last stmt in this loop but remember it
-  for replacing the original statement.  */
-   if (last)
-   {
- gsi_insert_before (si_p, last, GSI_NEW_STMT);
- gsi_next (si_p);
-   }
new_stmt = gsi_stmt (i);
/* The replacement can expose previously unreferenced variables.  */
if (gimple_in_ssa_p (cfun))
--- 619,627 
*** gimplify_and_update_call_from_tree (gimp
*** 642,648 
gimple_set_modified (new_stmt, true);
if (gimple_vdef (new_stmt))
reaching_vuse = gimple_vdef (new_stmt);
-   last = new_stmt;
  }
  
/* If the new sequence does not do a store release the virtual
--- 633,638 
*** gimplify_and_update_call_from_tree (gimp
*** 659,666 
}
  }
  
!   /* Finally replace rhe original statement with the last.  */
!   gsi_replace (si_p, last, false);
  }
  
  /* Return the string length, maximum string length or maximum value of
--- 649,656 
}
  }
  
!   /* Finally replace the original statement with the sequence.  */
!   gsi_replace_with_seq (si_p, stmts, false);
  }
  
  /* Return the string length, maximum string length or maximum value of
Index: gimple-iterator.c
===
*** gimple-iterator.c.orig  2012-05-01 22:43:34.0 +0200
--- gimple-iterator.c   2012-05-01 22:44:06.0 +0200
*** gsi_replace (gimple_stmt_iterator *gsi,
*** 433,438 
--- 433,456 
update_modified_stmt (stmt);
  }
  
+ void
+ gsi_replace_with_seq (gimple_stmt_iterator *gsi, gimple_seq seq,
+ bool update_eh_info)
+ {
+   gimple_stmt_iterator seqi;
+   gimple last;
+   if (gimple_seq_empty_p (seq))
+ {
+   gsi_remove (gsi, true);
+   return;
+ }
+   seqi = gsi_last (seq);
+   last = gsi_stmt (seqi);
+   gsi_remove (&seqi, false);
+   gsi_insert_seq_before (gsi, seq, GSI_SAME_STMT);
+   gsi_replace (gsi, last, update_eh_info);
+ }
+ 
  
  /* Insert statement STMT before the statement pointed-to by iterator I.
 M specifies how to update iterator I after insertion (see enum
Index: tree-ssa-forwprop.c
===
*** tree-ssa-forwprop.c.orig2012-05-01 22:39:07.0 +0200
--- tree-ssa-forwprop.c 2012-05-01 22:44:06.0 +0200
*** forward_propagate_addr_expr (tree name,
*** 1202,1217 
  }
  
  
! /* Forward propagate the comparison defined in STMT like
 cond_1 = x CMP y to uses of the form
   a_1 = (T')cond_1
   a_1 = !cond_1
   a_1 = cond_1 != 0
!Returns true if stmt is now unused.  */
  
  static bool
! forward_propagate_comparison (gimple stmt)
  {
tree name = gimple_assign_lhs (stmt);
gimple use_stmt;
tree tmp = NULL_TREE;
--- 1202,1219 
  }
  
  
! /* Forward propagate the comparison defined in *DEFGSI like
 cond_1 = x C

Patches for building libstdc++ on vxWorks

2012-05-01 Thread rbmj

These minor changes are needed to build libstdc++ on vxWorks.

Note- these diffs are based off of gcc 4.7.0

diff -durp -x '*~' a/gcc/gcov-io.c b/gcc/gcov-io.c
--- a/gcc/gcov-io.c2011-04-06 11:05:18.0 -0500
+++ b/gcc/gcov-io.c2012-01-15 21:27:41.407688488 -0500
@@ -92,7 +92,11 @@ gcov_open (const char *name, int mode)
 {
   /* Read-only mode - acquire a read-lock.  */
   s_flock.l_type = F_RDLCK;
+#ifdef __VXWORKS__
+  fd = open (name, O_RDONLY, 0666);
+#else
   fd = open (name, O_RDONLY);
+#endif
 }
   else
 {
diff -durp -x '*~' a/libgcc/libgcov.c b/libgcc/libgcov.c
--- a/libgcc/libgcov.c2011-01-04 13:05:06.0 -0500
+++ b/libgcc/libgcov.c2012-01-15 17:54:11.566928799 -0500
@@ -119,7 +119,7 @@ create_file_directory (char *filename)

 /* Try to make directory if it doesn't already exist.  */
 if (access (filename, F_OK) == -1
-#ifdef TARGET_POSIX_IO
+#if defined(TARGET_POSIX_IO) && !defined(__VXWORKS__)
&& mkdir (filename, 0755) == -1
 #else
&& mkdir (filename) == -1

--
rbmj


[4/6] Fold prev/next into gimple

2012-05-01 Thread Michael Matz
Hi,

this trivial patch just moves several gimple.h functions down to after the 
gimple_statement_d definition (whose members will be used by them with 
patch 6).

As per [0/6] regstrapped with the other five on x86_64-linux.  I consider 
this obvious.


Ciao,
Michael.
--
2012-05-02  Michael Matz  

* gimple.h (gimple_seq_first, gimple_seq_first_stmt, gimple_seq_last,
gimple_seq_last_stmt, gimple_seq_set_last, gimple_seq_set_first,
gimple_seq_empty_p, gimple_seq_alloc_with_stmt, bb_seq,
set_bb_seq): Move down to after gimple_statement_d definition.

Index: gimple.h
===
*** gimple.h.orig   2012-05-01 22:43:34.0 +0200
--- gimple.h2012-05-01 22:44:15.0 +0200
*** struct GTY ((chain_next ("%h.next_free")
*** 154,262 
  };
  
  
- /* Return the first node in GIMPLE sequence S.  */
- 
- static inline gimple_seq_node
- gimple_seq_first (const_gimple_seq s)
- {
-   return s ? s->first : NULL;
- }
- 
- 
- /* Return the first statement in GIMPLE sequence S.  */
- 
- static inline gimple
- gimple_seq_first_stmt (const_gimple_seq s)
- {
-   gimple_seq_node n = gimple_seq_first (s);
-   return (n) ? n->stmt : NULL;
- }
- 
- 
- /* Return the last node in GIMPLE sequence S.  */
- 
- static inline gimple_seq_node
- gimple_seq_last (const_gimple_seq s)
- {
-   return s ? s->last : NULL;
- }
- 
- 
- /* Return the last statement in GIMPLE sequence S.  */
- 
- static inline gimple
- gimple_seq_last_stmt (const_gimple_seq s)
- {
-   gimple_seq_node n = gimple_seq_last (s);
-   return (n) ? n->stmt : NULL;
- }
- 
- 
- /* Set the last node in GIMPLE sequence S to LAST.  */
- 
- static inline void
- gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
- {
-   s->last = last;
- }
- 
- 
- /* Set the first node in GIMPLE sequence S to FIRST.  */
- 
- static inline void
- gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
- {
-   s->first = first;
- }
- 
- 
- /* Return true if GIMPLE sequence S is empty.  */
- 
- static inline bool
- gimple_seq_empty_p (const_gimple_seq s)
- {
-   return s == NULL || s->first == NULL;
- }
- 
- 
- void gimple_seq_add_stmt (gimple_seq *, gimple);
- 
- /* Link gimple statement GS to the end of the sequence *SEQ_P.  If
-*SEQ_P is NULL, a new sequence is allocated.  This function is
-similar to gimple_seq_add_stmt, but does not scan the operands.
-During gimplification, we need to manipulate statement sequences
-before the def/use vectors have been constructed.  */
- void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
- 
- /* Allocate a new sequence and initialize its first element with STMT.  */
- 
- static inline gimple_seq
- gimple_seq_alloc_with_stmt (gimple stmt)
- {
-   gimple_seq seq = NULL;
-   gimple_seq_add_stmt (&seq, stmt);
-   return seq;
- }
- 
- 
- /* Returns the sequence of statements in BB.  */
- 
- static inline gimple_seq
- bb_seq (const_basic_block bb)
- {
-   return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
- }
- 
- 
- /* Sets the sequence of statements in BB to SEQ.  */
- 
- static inline void
- set_bb_seq (basic_block bb, gimple_seq seq)
- {
-   gcc_checking_assert (!(bb->flags & BB_RTL));
-   bb->il.gimple->seq = seq;
- }
- 
  /* Iterator object for GIMPLE statement sequences.  */
  
  typedef struct
--- 154,159 
*** extern tree tree_ssa_strip_useless_type_
*** 1135,1140 
--- 1032,1141 
  extern bool useless_type_conversion_p (tree, tree);
  extern bool types_compatible_p (tree, tree);
  
+ /* Return the first node in GIMPLE sequence S.  */
+ 
+ static inline gimple_seq_node
+ gimple_seq_first (const_gimple_seq s)
+ {
+   return s ? s->first : NULL;
+ }
+ 
+ 
+ /* Return the first statement in GIMPLE sequence S.  */
+ 
+ static inline gimple
+ gimple_seq_first_stmt (const_gimple_seq s)
+ {
+   gimple_seq_node n = gimple_seq_first (s);
+   return (n) ? n->stmt : NULL;
+ }
+ 
+ 
+ /* Return the last node in GIMPLE sequence S.  */
+ 
+ static inline gimple_seq_node
+ gimple_seq_last (const_gimple_seq s)
+ {
+   return s ? s->last : NULL;
+ }
+ 
+ 
+ /* Return the last statement in GIMPLE sequence S.  */
+ 
+ static inline gimple
+ gimple_seq_last_stmt (const_gimple_seq s)
+ {
+   gimple_seq_node n = gimple_seq_last (s);
+   return (n) ? n->stmt : NULL;
+ }
+ 
+ 
+ /* Set the last node in GIMPLE sequence S to LAST.  */
+ 
+ static inline void
+ gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
+ {
+   s->last = last;
+ }
+ 
+ 
+ /* Set the first node in GIMPLE sequence S to FIRST.  */
+ 
+ static inline void
+ gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
+ {
+   s->first = first;
+ }
+ 
+ 
+ /* Return true if GIMPLE sequence S is empty.  */
+ 
+ static inline bool
+ gimple_seq_empty_p (const_gimple_seq s)
+ {
+   return s == NULL || s->first == NULL;
+ }
+ 
+ 
+ void gimple_seq_add_stmt (gimple_seq *, gimple);
+ 
+ /* Link

[5/6] Fold prev/next into gimple

2012-05-01 Thread Michael Matz
Hi,

this patch basically is the one that makes all interfaces that possibly 
change a gimple_seq take a pointer to one, this time _including_ the 
statement iterator.

For that I opted to use the same idiom as our basic block edge iterators, 
namely via a wrapper macro that replaces the current gsi_start, and 
expands to "gsi_start_1 (&x)".

This means that now even an writable iterator can be formed from an empty 
list, which is magically filled when things are added via that iterator.  
This is the reason why the first patch made sure that the gsi_start calls 
only receive lvalues.  And this means also that the gimple_seq_alloc calls 
can be moved even more down to the low-level helpers.

I add some XXX remarks with this patch, for which I have already another 
patch fixing them again.  But it's not part of this series, so please bear 
with me.

This should still be a functional no-op, as should be the whole 1-5 
sequence of patches.  As per [0/6] regstrapped with the other five on 
x86_64-linux.  Okay for trunk?


Ciao,
Michael.

2012-05-02  Michael Matz  

* gimple.h (gimple_stmt_iterator ): Make it be pointer to
gimple_seq.
(gimple_seq_set_last, gimple_seq_set_first): Take pointer to
sequence, lazily allocate it.
(bb_seq_addr): New function.
(gsi_start_1): Rename from gsi_start, but take pointer to sequence.
(gsi_start): Macro to wrap gsi_start_1 taking pointer of argument.
(gsi_none): New function.
(gsi_start_bb): Adjust.
(gsi_last_1): Rename from gsi_last, but take pointer to sequence.
(gsi_last): Macro to wrap gsi_last_1 taking pointer of argument.
(gsi_last_bb): Adjust.
(gsi_seq): Adjust.
* tree-flow-inline.h (phi_nodes_ptr): New function.

* gimple-iterator.c (gsi_insert_seq_nodes_before): Adjust to 
datastructure and interface change.
(gsi_insert_seq_before_without_update): Ditto.
(gsi_insert_seq_nodes_after): Ditto.
(gsi_insert_seq_after_without_update): Ditto.
(gsi_split_seq_after): Ditto, don't use gimple_seq_alloc.
(gsi_split_seq_before): Ditto.
(gsi_start_phis): Adjust.
* tree-vect-loop.c (vect_determine_vectorization_factor): Use
gsi_none.
(vect_transform_loop): Ditto.
* gimple.c (gimple_seq_add_stmt, gimple_seq_add_seq,
gimple_seq_copy): Don't use gimple_seq_alloc.
* gimplify.c (gimple_seq_add_stmt_without_update): Ditto.
(gimplify_seq_add_seq): Ditto.
* lto-streamer-in.c (make_new_block): Ditto.
* tree-cfg.c (create_bb): Ditto.
* tree-sra.c (initialize_parameter_reductions): Ditto.

Index: gimple.h
===
*** gimple.h.orig   2012-05-01 22:44:15.0 +0200
--- gimple.h2012-05-01 22:44:17.0 +0200
*** typedef struct
*** 165,171 
   are necessary to handle edge cases such as when statement is
   added to an empty basic block or when the last statement of a
   block/sequence is removed.  */
!   gimple_seq seq;
basic_block bb;
  } gimple_stmt_iterator;
  
--- 165,171 
   are necessary to handle edge cases such as when statement is
   added to an empty basic block or when the last statement of a
   block/sequence is removed.  */
!   gimple_seq *seq;
basic_block bb;
  } gimple_stmt_iterator;
  
*** gimple_seq_last_stmt (const_gimple_seq s
*** 1070,1090 
  }
  
  
! /* Set the last node in GIMPLE sequence S to LAST.  */
  
  static inline void
! gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
  {
!   s->last = last;
  }
  
  
! /* Set the first node in GIMPLE sequence S to FIRST.  */
  
  static inline void
! gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
  {
!   s->first = first;
  }
  
  
--- 1070,1094 
  }
  
  
! /* Set the last node in GIMPLE sequence *PS to LAST.  */
  
  static inline void
! gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
  {
!   if (!*ps)
! *ps = gimple_seq_alloc ();
!   (*ps)->last = last;
  }
  
  
! /* Set the first node in GIMPLE sequence *PS to FIRST.  */
  
  static inline void
! gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
  {
!   if (!*ps)
! *ps = gimple_seq_alloc ();
!   (*ps)->first = first;
  }
  
  
*** bb_seq (const_basic_block bb)
*** 1125,1130 
--- 1129,1139 
return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
  }
  
+ static inline gimple_seq *
+ bb_seq_addr (const_basic_block bb)
+ {
+   return (!(bb->flags & BB_RTL) && bb->il.gimple) ? &bb->il.gimple->seq : 
NULL;
+ }
  
  /* Sets the sequence of statements in BB to SEQ.  */
  
*** is_gimple_reg_type (tree type)
*** 4940,4956 
  /* Return a new iterator pointing to GIMPLE_SEQ's first statement.  */
  
  static inline gimple_stmt_iterator
! gsi_start (gimple_seq s

[6/6] Fold prev/next into gimple: do it

2012-05-01 Thread Michael Matz
Hi,

and this patch flips the switch.  It removes the old seq_node and seq 
structures, adds the prev/next to gimple_statement_base, merges gimple, 
gimple_seq and gimple_seq_node and rewrites the helpers dealing with 
sequences or iterators to deal with the data structure of a cyclic list in 
the prev links and a NULL-ended list in the next links.

Note how a const_gimple_seq doesn't make sense anymore (I've typedefed it 
simply to gimple) as I'd have to add const casts for the (few) accessors.

Due to the adjustment of the WORD markers in gimple.h this patch is a bit 
longer than the functional changes imply.

There's one thing I'd like an opinion about: I've added two new flags to 
gimple_statement_base: start_of_seq and end_of_seq, and I had to 
shorten the uid member by two bits for that.  The two flags are used only 
for asserts (though they are updated always, they just aren't read except 
in asserts).  As I'm now finished developing this thing I'm not super sure 
about the usefullness of the asserts anymore, IIRC they didn't hit very 
often while developing; rather bugs usually turned into endless loops in 
sequence walkers.  So, I'd be happy to take them out again, straighten the 
asserts and leave uid be a normal 32bit integer.  Just tell me.

As per [0/6] regstrapped with the other five patches on x86_64-linux.  
Okay for trunk (with or without the start/end_of_seq flags)?


Ciao,
Michael.
--
2012-05-02  Michael Matz  

* coretypes.h (gimple_seq, const_gimple_seq): Typedef as gimple.
* gimple.h (struct gimple_seq_node_d, struct gimple_seq_d): Remove.
(const_gimple_seq_node): Remove.
(gimple_seq_node): Typedef as gimple.
(struct gimple_statement_base): Add start_of_seq and end_of_seq
members, make uid a 30 bit bitfield, add next and prev members.
Adjust all WORD markers in using structs.
(union gimple_statement_d): Link via gsbase.next field for GC and PCH.
(gimple_seq_first, gimple_seq_first_stmt, gimple_seq_last,
gimple_seq_last_stmt): Adjust as gimple_seq, gimple_seq_node and
gimple are the same.
(gimple_seq_set_last, gimple_seq_set_first): Don't allocate
gimple_seq, adjust.
(gsi_start_1, gsi_last_1, gsi_end_p, gsi_one_before_end_p): Adjust.
(gsi_next, gsi_prev): Adjust, handle prev cyclic list correctly.
(gsi_stmt): Adjust.
(gsi_stmt_ptr): Remove.
(enum gimple_alloc_kind): Remove gimple_alloc_kind_seq member.

* gimple-iterator.c (update_bb_for_stmts): Take last parameter
again, adjust for above changes.
(update_call_edge_frequencies): Adjust for above changes.
(gsi_insert_seq_nodes_before): Rewrite for new data structure.
(gsi_insert_seq_nodes_after): Ditto.
(gsi_split_seq_after): Ditto.
(gsi_set_stmt): Ditto.
(gsi_split_seq_before): Ditto.
(gsi_remove): Ditto.
(gsi_insert_seq_before_without_update): Don't free sequence.
(gsi_insert_seq_after_without_update): Ditto.
(gsi_replace): Assert some more invariants.
(gsi_insert_before_without_update, gsi_insert_after_without_update):
Tidy.
(gsi_for_stmt): Don't search for stmt.
(gsi_insert_on_edge_immediate): Tidy.

* gimple.c (gimple_alloc_k): Remove "sequences".
(gimple_seq_cache): Remove.
(gimple_alloc_stat): Make stmt a singleton sequence.
(gimple_seq_alloc, gimple_seq_free): Remove.
(gimple_assign_set_rhs_with_ops_1): Ensure new stmt is a singleton.
(gimple_copy): Ditto.
* gimplify.c (gimplify_cleanup_point_expr): Use gsi_set_stmt,
create iterator from correct sequence.
* tree-phinodes.c (make_phi_node): Make stmt a singleton.

Index: gimple.h
===
*** gimple.h.orig   2012-05-01 22:44:17.0 +0200
--- gimple.h2012-05-01 22:44:18.0 +0200
*** along with GCC; see the file COPYING3.
*** 32,40 
  #include "tree-ssa-alias.h"
  #include "internal-fn.h"
  
! struct gimple_seq_node_d;
! typedef struct gimple_seq_node_d *gimple_seq_node;
! typedef const struct gimple_seq_node_d *const_gimple_seq_node;
  
  /* For each block, the PHI nodes that need to be rewritten are stored into
 these vectors.  */
--- 32,38 
  #include "tree-ssa-alias.h"
  #include "internal-fn.h"
  
! typedef gimple gimple_seq_node;
  
  /* For each block, the PHI nodes that need to be rewritten are stored into
 these vectors.  */
*** enum plf_mask {
*** 133,159 
  GF_PLF_2  = 1 << 1
  };
  
- /* A node in a gimple_seq_d.  */
- struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) 
gimple_seq_node_d {
-   gimple stmt;
-   struct gimple_seq_node_d *prev;
-   struct gimple_seq_node_d *next;
- };
- 
- /* A double-linked sequence of gimple statements.  */
- struct GTY ((chain_next ("%h.next_fr

Re: [RFH / Patch] PR 51222

2012-05-01 Thread Jason Merrill

On 05/01/2012 08:14 PM, Paolo Carlini wrote:

I think we need to handle FIELD_DECL, too.

Are there hopes that handling FIELD_DECL like FUNCTION_DECL and VAR_DECL
(besides the DECL_LANG_SPECIFIC check) would work?


I would think so.


A data point I can give you, I put a gcc_assert (TREE_CODE (t) != FIELD_DECL) 
in the default case of the walk_template_parms_r switch, and it never triggers 
for the whole testsuite.


With your patch, what happens if you have a member access like

template 
struct A
{
  T t;
  auto f(A a) -> decltype (sizeof (a.t)) { }
};

I would expect that to hit the FIELD_DECL case.

Jason


Re: [RFH / Patch] PR 51222

2012-05-01 Thread Paolo Carlini

Hi,

On 05/02/2012 03:47 AM, Jason Merrill wrote:

On 05/01/2012 08:14 PM, Paolo Carlini wrote:

I think we need to handle FIELD_DECL, too.

Are there hopes that handling FIELD_DECL like FUNCTION_DECL and VAR_DECL
(besides the DECL_LANG_SPECIFIC check) would work?

I would think so.

Ok, if we want it, I adjusted the code, see attached.
A data point I can give you, I put a gcc_assert (TREE_CODE (t) != 
FIELD_DECL) in the default case of the walk_template_parms_r switch, 
and it never triggers for the whole testsuite.


With your patch, what happens if you have a member access like

template 
struct A
{
  T t;
  auto f(A a) -> decltype (sizeof (a.t)) { }
};

I would expect that to hit the FIELD_DECL case.
Well, not really. The first time walk_template_parms_r is called, t is a 
SIZEOF_EXPR which remains unhandled, the function returns NULL_TREE. The 
second time, t is a COMPONENT_REF, thus !TYPE_P (t) is true, TREE_TYPE 
is NULL, the function immediately returns error_mark_node and the 
iteration ends (with the correct result that the expression is 
instantiation-dependent).


Does it make sense?

Anyway, the attached appear to also pass the testsuite, I could test it 
more completely tomorrow. If the FIELD_DECL bits seem safe to have... ;)


Thanks,
Paolo.


Index: pt.c
===
--- pt.c(revision 187012)
+++ pt.c(working copy)
@@ -145,8 +145,8 @@ static tree convert_nontype_argument_function (tre
 static tree convert_nontype_argument (tree, tree, tsubst_flags_t);
 static tree convert_template_argument (tree, tree, tree,
   tsubst_flags_t, int, tree);
-static int for_each_template_parm (tree, tree_fn_t, void*,
-  struct pointer_set_t*, bool);
+static int walk_template_parms (tree, tree_fn_t, void*,
+   struct pointer_set_t*, bool, bool);
 static tree expand_template_argument_pack (tree);
 static tree build_template_parm_index (int, int, int, int, tree, tree);
 static bool inline_needs_template_parms (tree);
@@ -185,7 +185,7 @@ static int coerce_template_template_parms (tree, t
 static bool template_template_parm_bindings_ok_p (tree, tree);
 static int template_args_equal (tree, tree);
 static void tsubst_default_arguments (tree);
-static tree for_each_template_parm_r (tree *, int *, void *);
+static tree walk_template_parms_r (tree *, int *, void *);
 static tree copy_default_args_to_explicit_spec_1 (tree, tree);
 static void copy_default_args_to_explicit_spec (tree);
 static int invalid_nontype_parm_type_p (tree, tsubst_flags_t);
@@ -4276,8 +4276,8 @@ mark_template_parm (tree t, void* data)
   tpd->arg_uses_template_parms[tpd->current_arg] = 1;
 }
 
-  /* Return zero so that for_each_template_parm will continue the
- traversal of the tree; we want to mark *every* template parm.  */
+  /* Return zero so that walk_template_parms will continue the traversal
+ of the tree; we want to mark *every* template parm.  */
   return 0;
 }
 
@@ -4344,11 +4344,12 @@ process_partial_specialization (tree decl)
   for (i = 0; i < nargs; ++i)
 {
   tpd.current_arg = i;
-  for_each_template_parm (TREE_VEC_ELT (inner_args, i),
- &mark_template_parm,
- &tpd,
- NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (TREE_VEC_ELT (inner_args, i),
+  &mark_template_parm,
+  &tpd,
+  NULL,
+  /*check_types=*/false,
+  /*include_nondeduced_p=*/false);
 }
   for (i = 0; i < ntparms; ++i)
 if (tpd.parms[i] == 0)
@@ -4481,11 +4482,12 @@ process_partial_specialization (tree decl)
   tpd2.current_arg = i;
   tpd2.arg_uses_template_parms[i] = 0;
   memset (tpd2.parms, 0, sizeof (int) * nargs);
-  for_each_template_parm (type,
-  &mark_template_parm,
-  &tpd2,
-  NULL,
- /*include_nondeduced_p=*/false);
+  walk_template_parms (type,
+  &mark_template_parm,
+  &tpd2,
+  NULL,
+  /*check_types=*/false,
+  /*include_nondeduced_p=*/false);
 
   if (tpd2.arg_uses_template_parms [i])
 {
@@ -4755,7 +4757,7 @@ check_default_tmpl_args (tree decl, tree parms, in
 }
 
 /* Worker for push_template_decl_real, called via
-   for_each_template_parm.  DATA is really an int, indicating the
+   walk_template_parms.  DATA is really an int, indicating the
level o

Re: [6/6] Fold prev/next into gimple: do it

2012-05-01 Thread Basile Starynkevitch
On Wed, 2 May 2012 03:47:17 +0200 (CEST)
Michael Matz  wrote:

> There's one thing I'd like an opinion about: I've added two new flags to 
> gimple_statement_base: start_of_seq and end_of_seq, and I had to 
> shorten the uid member by two bits for that.  The two flags are used only 
> for asserts (though they are updated always, they just aren't read except 
> in asserts).  As I'm now finished developing this thing I'm not super sure 
> about the usefullness of the asserts anymore, IIRC they didn't hit very 
> often while developing; rather bugs usually turned into endless loops in 
> sequence walkers.  So, I'd be happy to take them out again, straighten the 
> asserts and leave uid be a normal 32bit integer.  Just tell me.


I believe that uid should stay normal integers. Plugins may find a use for all 
the
available bits. And perhaps even developers of other passes.

Cheers.

-- 
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basilestarynkevitchnet mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***


Re: [Patch, fortran] PR41600 - [OOP] SELECT TYPE with associate-name => exp: Arrays not supported

2012-05-01 Thread Tobias Burnus

Dear Paul,

Paul Richard Thomas wrote:

Find attached a revised patch to fix PR 41600.


Thanks for the patch. I think it is OK.

Regarding:


!   if (ref&&  ref->type != REF_ARRAY&&  seen_array)
!   {
! gfc_error ("CLASS selector at %L is an array with CLASS "
!"components; this is not allowed since the "
!"elements could have different dynamic types",
!   &target->where);


Could you open a PR for it? If possible with a test case.

Tobias


Re: [patch] Update DWARF codes for Fission

2012-05-01 Thread Jakub Jelinek
On Tue, May 01, 2012 at 04:17:02PM -0700, Cary Coutant wrote:
> This patch to include/dwarf2.def updates the DW_FORM and DW_AT codes
> for the Fission extensions. We've eliminated DW_FORM_GNU_ref_index,
> and replaced DW_AT_GNU_ref_base with DW_AT_GNU_ranges_base. (The wiki
> page at http://gcc.gnu.org/wiki/DebugFission has been updated.)
> 
> OK for binutils and gcc?

Okay.

> 2012-05-01  Cary Coutant  
> 
>   * dwarf2.def: Remove DW_FORM_GNU_ref_index,
>   replace DW_AT_GNU_ref_base with DW_AT_GNU_ranges_base.
> 
> 
> commit bc45612d20fad44534b0efeeb821671d8e8c5b63
> Author: Cary Coutant 
> Date:   Tue May 1 16:08:08 2012 -0700
> 
> Update DW_FORM and DW_AT codes for Fission.

Jakub


Patch to enable --with-multilib-list for arm-none-eabi target

2012-05-01 Thread Terry Guo
Hello,

This patch provides a bunch of predefined MULTILIB for various arm-none-eabi
targets. The MULTILIB_EXCEPTIONS isn't needed because the patch takes
advantage of the new term MULTILIB_REQUIRED which is introduced at
http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00975.html. The existing
configure option --with-multilib-list is enabled as an interface for user to
specify needed libraries from the predefined set. For example if only need
to build Multilib for targets armv7-m and armv7e-m, then the gcc can be
configured with --with-multilib-list=armv7-m,armv7e-m.

Please note that the predefined Multilib set in this patch doesn't cover all
possible cases like big-endian version Multilib. User can extend this set
and just build needed ones through --with-multili-list. So far this patch
can recognize armv6-m, armv7-m, armv7e-m, armv7-r and armv7-a as the options
used in --with-multilib-list.

Tested on trunk for arm-none-eabi target. Is it ok to trunk?

BR,
Terry

2012-05-02  Terry Guo  

* config.gcc: Include more MULTILIB implementations for ARM EABI.
* config/arm/t-mlibs: New file to define more MULTILIB 
  implementations for ARM targets.
* configure.ac: Enable --with-multilib-list for ARM 
  and export it for being used in Makefile.in.
* configure: Regenerated.   
* Makefile.in: Import configure option --with-multilib-list.

enable-with-multilib-list-for-arm.patch
Description: Binary data


Re: libgo patch committed: Fix build on MIPS GNU/Linux

2012-05-01 Thread Andrew Pinski
On Tue, May 1, 2012 at 12:18 PM, Ian Lance Taylor  wrote:
> Andrew Pinski  writes:
>
>> I tested the trunk after this patch on mips64-linux-gnu (with glibc
>> 2.15) and the testsuite looks good.
>
> Thanks for testing.
>
>> FAIL: go.test/test/nilptr.go execution,  -O2 -g
>
> The nilptr.go test is known to fail on various targets.  Search for
> nilptr in gcc/testsuite/go.test/go-test.exp.  Probably we just need to
> add mips64 there.
>
>>               === libgo tests ===
>>
>>
>> Running target unix
>> FAIL: runtime
>> FAIL: net/http
>> FAIL: text/template
>>
>>               === libgo Summary for unix ===
>>
>> # of expected passes          120
>> # of unexpected failures      3
>
>
>
>> Running target unix/-mabi=64
>> FAIL: net/http
>>
>>               === libgo Summary for unix/-mabi=64 ===
>>
>> # of expected passes          122
>> # of unexpected failures      1


n32 failures:

--- FAIL: runtime_test.TestGcSys (0.56 seconds)
mfinal_test.go:35: used 4718592 extra bytes
mfinal_test.go:37: using too much memory: 4718592 bytes
FAIL
FAIL: runtime
/home/apinski/src/gcc-fsf/local/gcc/libgo/testsuite/gotest: line 448:
gotest-timeout: No such file or directory

panic: test timed out
FAIL: net/http
..
--- FAIL: template.TestExecute (0.29 seconds)
template.go:531: chained method: unexpected execute error:
template: chained method:1: nil pointer evaluating
*template.U.TrueFalse
template.go:531: chained method on variable: unexpected
execute error: template: chained method on variable:1: nil pointer
evaluating *template.U.TrueFalse
template.go:541: range count: expected
"[0]a[1]b[2]c[3]d[4]e"
got
""
FAIL
FAIL: text/template

n64:
panic: test timed out
FAIL: net/http
/home/apinski/src/gcc-fsf/local/gcc/libgo/testsuite/gotest: line 448:
gotest-timeout: No such file or directory



>
>
> I don't know what is going on with these failures.
>
> Ian


Re: [patch, committed] invoke.texi: clean up texinfo markup

2012-05-01 Thread Gerald Pfeifer
Hi Sandra,

On Fri, 6 Apr 2012, Sandra Loosemore wrote:
> This is another installment in my series of cleanups to invoke.texi.  
> In this patch I have taken a break from nit-picking grammar and have 
> nit-picked some Texinfo markup issues instead.

kudos for the work you are doing on this front!  This is quite
laborsome and not exactly thankful, but worthwhile.


Index: gcc/doc/invoke.texi
===
-With -std=c++11, @option{-Wno-narrowing} suppresses the diagnostic
+With @option{-std=c++11}, @option{-Wno-narrowing} suppresses the diagnostic
 required by the standard.  Note that this does not affect the meaning
 of well-formed code; narrowing conversions are still considered
 ill-formed in SFINAE context.

I am not sure this change is correct.  I believe the intended meaning
was "when the active standard is C++11" which may include "-std=g++11"
as well, or other ways to activate that, not to refer to that specific
command-line option.

-either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
-@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
+either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
+@option{-Wunused}), or separately specify @option{-Wunused-parameter}.

Is @option{...} appropriate for a combination of two options as well?

-of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
+of @option{-Wextra} without this warning, use @option{-Wextra 
-Wno-sign-compare}.

Same here.

-warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
+warnings without this one, use @option{-Wextra 
-Wno-missing-field-initializers}.

And here.

-@option{-Wextra} warnings without this one, use @samp{-Wextra
+@option{-Wextra} warnings without this one, use @option{-Wextra
 -Wno-override-init}.

And here.

+This is a set of options that are used to explicitly disable/enable
+optimization passes.  These options are intended for use for debugging GCC.

How about "intended to debug GCC"?

-compiling @file{foo.c} with @samp{-c -save-temps} would produce files
+compiling @file{foo.c} with @option{-c -save-temps} would produce files

See above.

-those listed here.  You can invoke GCC with @samp{-Q --help=optimizers}
+those listed here.  You can invoke GCC with @option{-Q --help=optimizers}

Same here.

-option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
+option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support

And here.

-@samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
+@option{-Xlinker -assert -Xlinker definitions}.  It does not work to write

And here.

-@samp{-Xlinker -Map=output.map} rather than
-@samp{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
+@option{-Xlinker -Map=output.map} rather than
+@option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support

And here.

-For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
+For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to 
the

And here.

+@option{-mno-shared -mabicalls}.  For the n64 ABI, this option

And here.

+@option{-mcpu=970 -mno-altivec}.

And here.

+Specify type of floating-point unit.  Valid values for @var{name} are

Should this read "the type of"?

-@samp{extern} declarations are not affected by @samp{-fvisibility}, so
-a lot of code can be recompiled with @samp{-fvisibility=hidden} with
-no modifications.  However, this means that calls to @samp{extern}
+@samp{extern} declarations are not affected by @option{-fvisibility}, so
+a lot of code can be recompiled with @option{-fvisibility=hidden} with
+no modifications.  However, this means that calls to @code{extern}

Why @samp{extern} and not @code{extern}?

-declare all peripheral bit-fields as ``unsigned short'' (assuming short
+declare all peripheral bit-fields as @code{unsigned short} (assuming short

Should "short" be "@code{short}" here?

Gerald


Re: [PATCH] libatomic, v2

2012-05-01 Thread Gerald Pfeifer
Hi Richard,

On Tue, 1 May 2012, Richard Henderson wrote:
> Now committed.

mind writing up something for the release notes?  If you provide
me text, I can take care of marking it up and committing it.

Gerald