Re: [PATCH] Put -lasan always very early on the ld command line (PR sanitizer/55374)

2013-02-05 Thread Eric Botcazou
 2013-01-22  Jakub Jelinek  ja...@redhat.com
 
   PR sanitizer/55374
   * gcc.c (LIBASAN_SPEC): Define just to ADD_STATIC_LIBASAN_LIBS if
   LIBASAN_EARLY_SPEC is defined.
   (LIBASAN_EARLY_SPEC): Define to empty string if not already defined.
   (LINK_COMMAND_SPEC): Add LIBASAN_EARLY_SPEC for -fsanitize=address,
   before %o.
   * config/gnu-user.h (LIBASAN_EARLY_SPEC): Define.

This has introduced a syntax error for gcc.c when you're building a quick 
cross-compiler.  Fixed by the attached patchlet.

Tested on x86_64-suse-linux, OK for the mainline?


2013-02-05  Eric Botcazou  ebotca...@adacore.com

PR sanitizer/55374
* config/gnu-user.h (LIBASAN_EARLY_SPEC): Add missing guard.


-- 
Eric BotcazouIndex: config/gnu-user.h
===
--- config/gnu-user.h	(revision 195694)
+++ config/gnu-user.h	(working copy)
@@ -102,10 +102,12 @@ see the files COPYING3 and COPYING.RUNTI
it for -shared link, the executable should be compiled with -static-libasan
in that case, and for executable link link with --{,no-}whole-archive around
it to force everything into the executable.  */
+#if defined(HAVE_LD_STATIC_DYNAMIC)
 #undef LIBASAN_EARLY_SPEC
 #define LIBASAN_EARLY_SPEC %{static-libasan:%{!shared: \
   LD_STATIC_OPTION  --whole-archive -lasan --no-whole-archive  \
   LD_DYNAMIC_OPTION }}%{!static-libasan:-lasan}
+#endif
 
 /* Additional libraries needed by -static-libasan.  */
 #undef STATIC_LIBASAN_LIBS

Re: [PATCH] Put -lasan always very early on the ld command line (PR sanitizer/55374)

2013-02-05 Thread Jakub Jelinek
On Tue, Feb 05, 2013 at 09:37:29AM +0100, Eric Botcazou wrote:
 Tested on x86_64-suse-linux, OK for the mainline?
 
 
 2013-02-05  Eric Botcazou  ebotca...@adacore.com
 
   PR sanitizer/55374
   * config/gnu-user.h (LIBASAN_EARLY_SPEC): Add missing guard.

Yes, thanks.

 Index: config/gnu-user.h
 ===
 --- config/gnu-user.h (revision 195694)
 +++ config/gnu-user.h (working copy)
 @@ -102,10 +102,12 @@ see the files COPYING3 and COPYING.RUNTI
 it for -shared link, the executable should be compiled with 
 -static-libasan
 in that case, and for executable link link with --{,no-}whole-archive 
 around
 it to force everything into the executable.  */
 +#if defined(HAVE_LD_STATIC_DYNAMIC)
  #undef LIBASAN_EARLY_SPEC
  #define LIBASAN_EARLY_SPEC %{static-libasan:%{!shared: \
LD_STATIC_OPTION  --whole-archive -lasan --no-whole-archive  \
LD_DYNAMIC_OPTION }}%{!static-libasan:-lasan}
 +#endif
  
  /* Additional libraries needed by -static-libasan.  */
  #undef STATIC_LIBASAN_LIBS

Jakub


Re: [PATCH] Fix PR56131 - gcc.dg/pr56035.c ICEs gcc on sparc-linux

2013-02-05 Thread Eric Botcazou
 The problem is that in delete_insn, while deleting an undeletable label (in
 other words, transforming a label into a INSN_NOTE_DELETED_LABEL):
 - we try to find the bb of a NOTE_INSN_BASIC_BLOCK following the label using
 BLOCK_FOR_INSN (which is NULL) instead of NOTE_BASIC_BLOCK (which is not
 NULL), and
 - we don't handle the case that we find a NULL pointer for that bb
 gracefully.

Can the NOTE_BASIC_BLOCK of a NOTE_INSN_BASIC_BLOCK really be NULL?

 This comment in insn-notes.def tells us that the bb info could be in either
 of the two:
 ...
 /* Record the struct for the following basic block.  Uses
NOTE_BASIC_BLOCK.  FIXME: Redundant with the basic block pointer
now included in every insn.  */
 INSN_NOTE (BASIC_BLOCK)
 ...
 
 The patch fixes the problems by:
 - using NOTE_BASIC_BLOCK to find the bb of NOTE_INSN_BASIC_BLOCK, and
 - explicitly handling the cases that the bb of either the label or the note
 is NULL.

I don't think that we need to handle the very last case.

 2013-02-04  Tom de Vries  t...@codesourcery.com
 
   PR rtl-optimization/56131
   * cfgrtl.c (delete_insn): Use NOTE_BASIC_BLOCK instead of BLOCK_FOR_INSN
   to get the bb of a NOTE_INSN_BASIC_BLOCK.  Handle the case that the bb
   of the label is NULL.  Add comment.

OK on principle, but remove the handling of the NULL NOTE_BASIC_BLOCK and keep 
everything in a single condition.

-- 
Eric Botcazou


Re: Error in gcc.gnu. org/install/configure.html webpage

2013-02-05 Thread Richard Biener
On Mon, Feb 4, 2013 at 9:43 PM, Zhiming Wang zmw...@stanford.edu wrote:
 Hi there,

 When reading through http://gcc.gnu.org/install/configure.html configuration 
 options, I spotted an inconsistency regarding Graphite loop optimization:

 
 --with-ppl=pathname
 --with-ppl-include=pathname
 --with-ppl-lib=pathname
 --with-cloog=pathname
 --with-cloog-include=pathname
 --with-cloog-lib=pathname
 If you do not have ISL and the CLooG libraries installed in a standard 
 location and you want to build GCC, you can explicitly specify the directory 
 where they are installed (`--with-isl=islinstalldir', 
 `--with-cloog=clooginstalldir'). The --with-isl=islinstalldir option is 
 shorthand for --with-isl-lib=islinstalldir/lib and 
 --with-isl-include=islinstalldir/include. Likewise the 
 --with-cloog=clooginstalldir option is shorthand for 
 --with-cloog-lib=clooginstalldir/lib and 
 --with-cloog-include=clooginstalldir/include. If these shorthand assumptions 
 are not correct, you can use the explicit include and lib options directly.
 

 The listed option is —with-ppl, but the description refers to —with-isl 
 instead. This is rather tricky. Hope you can fix this!

 Many thanks for your great work,
 Z.W.

Fixed.

Richard.


p
Description: Binary data


Re: [PATCH] Fix PR56131 - gcc.dg/pr56035.c ICEs gcc on sparc-linux

2013-02-05 Thread Tom de Vries
Eric,

thanks for the review.

On 05/02/13 10:02, Eric Botcazou wrote:
 The problem is that in delete_insn, while deleting an undeletable label (in
 other words, transforming a label into a INSN_NOTE_DELETED_LABEL):
 - we try to find the bb of a NOTE_INSN_BASIC_BLOCK following the label using
 BLOCK_FOR_INSN (which is NULL) instead of NOTE_BASIC_BLOCK (which is not
 NULL), and
 - we don't handle the case that we find a NULL pointer for that bb
 gracefully.
 
 Can the NOTE_BASIC_BLOCK of a NOTE_INSN_BASIC_BLOCK really be NULL?
 

I don't know, I was just trying to do defensive programming.

 This comment in insn-notes.def tells us that the bb info could be in either
 of the two:
 ...
 /* Record the struct for the following basic block.  Uses
NOTE_BASIC_BLOCK.  FIXME: Redundant with the basic block pointer
now included in every insn.  */
 INSN_NOTE (BASIC_BLOCK)
 ...

 The patch fixes the problems by:
 - using NOTE_BASIC_BLOCK to find the bb of NOTE_INSN_BASIC_BLOCK, and
 - explicitly handling the cases that the bb of either the label or the note
 is NULL.
 
 I don't think that we need to handle the very last case.
 

OK.

 2013-02-04  Tom de Vries  t...@codesourcery.com

  PR rtl-optimization/56131
  * cfgrtl.c (delete_insn): Use NOTE_BASIC_BLOCK instead of BLOCK_FOR_INSN
  to get the bb of a NOTE_INSN_BASIC_BLOCK.  Handle the case that the bb
  of the label is NULL.  Add comment.
 
 OK on principle, but remove the handling of the NULL NOTE_BASIC_BLOCK and 
 keep 
 everything in a single condition.
 

I've adopted the patch according to your comments, rebuild sparc-linux cc1 and
tested that the ICE does not occur.

I'll bootstrap and retest on x86_64 and check in attached patch.

Thanks,
- Tom


Index: gcc/cfgrtl.c
===
--- gcc/cfgrtl.c (revision 195747)
+++ gcc/cfgrtl.c (working copy)
@@ -135,7 +135,7 @@ delete_insn (rtx insn)
   if (! can_delete_label_p (insn))
 	{
 	  const char *name = LABEL_NAME (insn);
-	  basic_block bb = BLOCK_FOR_INSN (insn);
+	  basic_block bb, label_bb = BLOCK_FOR_INSN (insn);
 	  rtx bb_note = NEXT_INSN (insn);
 
 	  really_delete = false;
@@ -143,10 +143,16 @@ delete_insn (rtx insn)
 	  NOTE_KIND (insn) = NOTE_INSN_DELETED_LABEL;
 	  NOTE_DELETED_LABEL_NAME (insn) = name;
 
-	  if (bb_note != NULL_RTX  NOTE_INSN_BASIC_BLOCK_P (bb_note)
-	   BLOCK_FOR_INSN (bb_note) == bb)
+	  /* If the note following the label starts a basic block, and the
+	 label is a member of the same basic block, interchange the two.
+	 If the label is not marked with a bb, assume it's the same bb.  */
+	  if (bb_note != NULL_RTX
+	   NOTE_INSN_BASIC_BLOCK_P (bb_note)
+	   (label_bb == NOTE_BASIC_BLOCK (bb_note)
+		  || label_bb == NULL))
 	{
 	  reorder_insns_nobb (insn, insn, bb_note);
+	  bb = NOTE_BASIC_BLOCK (bb_note);
 	  BB_HEAD (bb) = bb_note;
 	  if (BB_END (bb) == bb_note)
 		BB_END (bb) = insn;


Re: [PATCH] Fix PR56131 - gcc.dg/pr56035.c ICEs gcc on sparc-linux

2013-02-05 Thread Tom de Vries
On 05/02/13 10:50, Jakub Jelinek wrote:
 On Tue, Feb 05, 2013 at 10:41:51AM +0100, Tom de Vries wrote:
 On 05/02/13 10:02, Eric Botcazou wrote:
 The problem is that in delete_insn, while deleting an undeletable label (in
 other words, transforming a label into a INSN_NOTE_DELETED_LABEL):
 - we try to find the bb of a NOTE_INSN_BASIC_BLOCK following the label 
 using
 BLOCK_FOR_INSN (which is NULL) instead of NOTE_BASIC_BLOCK (which is not
 NULL), and
 - we don't handle the case that we find a NULL pointer for that bb
 gracefully.

 Can the NOTE_BASIC_BLOCK of a NOTE_INSN_BASIC_BLOCK really be NULL?


 I don't know, I was just trying to do defensive programming.
 
 I'd say the bug is in whatever made the note not contain the appropriate bb.
 

Jakub,

I'm not sure I understand your comment.

The BLOCK_FOR_INSN of the note was NULL. The NOTE_BASIC_BLOCK of the note was
correct. Are you saying that the BLOCK_FOR_INSN should not have been NULL?

Thanks,
- Tom

   Jakub
 



Re: [Patch, Fortran] PR54339 - Update gfortran.texi's standard refs, status and TS29113 sections

2013-02-05 Thread Tobias Burnus

* ping *
http://gcc.gnu.org/ml/fortran/2013-01/msg00223.html

Tobias Burnus:
As promised: A patch for the regression PR54339. I am sure there is 
room for improvement :-)


Everyone: Please feel free to comment on the current documentation, 
http://gcc.gnu.org/onlinedocs/gfortran/ , and on the attached patch.


OK for the trunk?

Tobias




Re: [PATCH] Fix PR56131 - gcc.dg/pr56035.c ICEs gcc on sparc-linux

2013-02-05 Thread Jakub Jelinek
On Tue, Feb 05, 2013 at 11:01:22AM +0100, Tom de Vries wrote:
 I'm not sure I understand your comment.
 
 The BLOCK_FOR_INSN of the note was NULL. The NOTE_BASIC_BLOCK of the note was
 correct. Are you saying that the BLOCK_FOR_INSN should not have been NULL?

Yeah, I mean the following invariant should hold IMHO:
!NOTE_INSN_BASIC_BLOCK_P (insn) || NOTE_BASIC_BLOCK (insn) == BLOCK_FOR_INSN 
(insn)
NOTE_INSN_BASIC_BLOCK for some bb outside of that bb?  That looks fishy.
Haven't bootstrapped/regtested with such a check anywhere, just compiled one
largish C++ testcase with it.

Jakub


Re: [PATCH] Fix PR56131 - gcc.dg/pr56035.c ICEs gcc on sparc-linux

2013-02-05 Thread Tom de Vries
On 05/02/13 11:12, Jakub Jelinek wrote:
 On Tue, Feb 05, 2013 at 11:01:22AM +0100, Tom de Vries wrote:
 I'm not sure I understand your comment.

 The BLOCK_FOR_INSN of the note was NULL. The NOTE_BASIC_BLOCK of the note was
 correct. Are you saying that the BLOCK_FOR_INSN should not have been NULL?
 
 Yeah, I mean the following invariant should hold IMHO:
 !NOTE_INSN_BASIC_BLOCK_P (insn) || NOTE_BASIC_BLOCK (insn) == BLOCK_FOR_INSN 
 (insn)
 NOTE_INSN_BASIC_BLOCK for some bb outside of that bb?  That looks fishy.
 Haven't bootstrapped/regtested with such a check anywhere, just compiled one
 largish C++ testcase with it.
 

Jakub,

I've used patch below to print rtl with a BLOCK_FOR_INSN annotation, and looked
at behaviour for x86_64 and sparc.

For sparc, BLOCK_FOR_INSN is always NULL starting at pass_mach dump files, due
to pass_free_cfg that calls free_bb_for_insn, whose only purpose is to set the
BLOCK_FOR_INSN field to NULL.

So all NOTE_INSN_BASIC_BLOCKs in the .mach dump and after violate the invariant
formulated above:
...
[bfi NULL](note 13 8 201 [bb 2] NOTE_INSN_BASIC_BLOCK)
...

For x86_64, we recompute BLOCK_FOR_INSN in pass_mach here:
...
static void
ix86_reorg (void)
{
  /* We are freeing block_for_insn in the toplev to keep compatibility
 with old MDEP_REORGS that are not CFG based.  Recompute it now.  */
  compute_bb_for_insn ();
...
so we have BLOCK_FOR_INSN all the way till pass_final.

The PR56131 ICE occurred for sparc in pass_delay_slots, after pass_mach, so it's
expected that BLOCK_FOR_INSN is NULL.

Thanks,
- Tom


Index: gcc/print-rtl.c
===
--- gcc/print-rtl.c (revision 195747)
+++ gcc/print-rtl.c (working copy)
@@ -800,6 +800,20 @@ print_rtl_single_with_indent (FILE *outf
   sawclose = 0;
   fputs (s_indent, outfile);
   fputs (print_rtx_head, outfile);
+#ifndef GENERATOR_FILE
+  {
+basic_block bb;
+if (GET_RTX_LENGTH (GET_CODE (x)) = 4
+GET_RTX_FORMAT (GET_CODE (x))[3] == 'B')
+  {
+   bb = BLOCK_FOR_INSN (x);
+   if (bb != 0)
+ fprintf (outfile,  [bfi %d], bb-index);
+   else
+ fprintf (outfile,  [bfi NULL]);
+  }
+  }
+#endif



Re: [PATCH] collect2 should accept more AIX linker flags to change shared library search order

2013-02-05 Thread Michael Haubenwallner

On 02/04/2013 10:33 PM, David Edelsohn wrote:
 2013-02-04  Michael Haubenwallner michael.haubenwall...@salomon.at
 
   Accept all flags that enable aix runtime linking to change the
   library search order. Also there is a disabling flag.

 This patch is okay, and I agree that it should use strncmp.

Updated to use strcmp/strncmp. While at it, also check for -bexport: instead
of -bexport, as this (and -bE:) always needs the filename anyway.

 Do you have SVN write access?

Nope.

Thank you!
/haubi/
2013-02-05  Michael Haubenwallner michael.haubenwall...@salomon.at

	Accept all flags that enable aix runtime linking to change the
	library search order. Also there is a disabling flag.
	* collect2.c (aixrtl_flag): Enabled by -G and -bsvr4 too, disabled
	by -bnortl. Use strcmp,strncmp for all these aix flags too. And
	-bexport always needs the filename, so test for '-bexport:'.
---
 gcc/collect2.c |   28 ++--
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gcc/collect2.c b/gcc/collect2.c
index 0db908f..99dd41d 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1022,20 +1022,20 @@ main (int argc, char **argv)
 	  selected_linker = USE_GOLD_LD;
 
 #ifdef COLLECT_EXPORT_LIST
-	/* since -brtl, -bexport, -b64 are not position dependent
-	   also check for them here */
-	if ((argv[i][0] == '-')  (argv[i][1] == 'b'))
-  	  {
-	arg = argv[i];
-	/* We want to disable automatic exports on AIX when user
-	   explicitly puts an export list in command line */
-	if (arg[2] == 'E' || strncmp (arg[2], export, 6) == 0)
-	  export_flag = 1;
-	else if (arg[2] == '6'  arg[3] == '4')
-	  aix64_flag = 1;
-	else if (arg[2] == 'r'  arg[3] == 't'  arg[4] == 'l')
-	  aixrtl_flag = 1;
-	  }
+	/* These flags are position independent, although their order
+	   is important - subsequent flags override earlier ones. */
+	else if (strcmp (argv[i], -b64) == 0)
+	aix64_flag = 1;
+	/* -bexport:filename always needs the :filename */
+	else if (strncmp (argv[i], -bE:, 4) == 0
+	  || strncmp (argv[i], -bexport:, 9) == 0)
+	export_flag = 1;
+	else if (strcmp (argv[i], -brtl) == 0
+	  || strcmp (argv[i], -bsvr4) == 0
+	  || strcmp (argv[i], -G) == 0)
+	aixrtl_flag = 1;
+	else if (strcmp (argv[i], -bnortl) == 0)
+	aixrtl_flag = 0;
 #endif
   }
 vflag = debug;
-- 
1.7.3.4



Re: [PR 54051 ARM] Fix alignment specifier alignment information for ARM.

2013-02-05 Thread Ramana Radhakrishnan

On 02/05/13 07:43, Ye Joey wrote:

Ramana,

This issue also impacts ldrexh/ldrexb, as assembler doesn't accept
ldrexh r1, [r0, #0]. May it be backported to 4.7 by now?

Thanks - Joey


Ok by me unless RM's object. It's been on trunk long enough and hasn't 
caused any issues that I'm aware of.


Thanks for bringing this up. It looks like it slipped through the cracks 
when I left Linaro.


regards
Ramana


On Tue, Jul 24, 2012 at 8:09 PM, Ramana Radhakrishnan
ramana.radhakrish...@linaro.org wrote:

Hi ,


   While testing my neon intrinsics work with some testcases
that I was writing up, I ran into PR54051 . The one change which is
probably a bit long standing is the fact that for register only
addressing modes i.e. something like mem (reg:SI) we were printing out
addresses with an immediate of #0. Historically the reason for this
appears to be to deal with an assembler bug of yesteryears where the
assembler couldn't  sometimes properly distinguish between auto-inc
addressing forms and the register indirect addressing form which I'm
informed is fixed. This patch has gone through a full test run with
qemu in a cross environment with no regressions for armv7-a / neon /
arm/ thumb with a v5t multilib for c, c++ .

I intend to backport this to 4.7 as this is a regression compared to
4.6, after letting it be on trunk for a few days to see if the
auto-testers pick anything else up unless there is an objection from
anyone.

regards
Ramana




 PR target/54051
 * config/arm/arm.c (arm_print_operand_address): Remove superfluous
 printing of #0.
 * config/arm/neon.md (neon_vld3_lanemode:VD): Remove alignment
 specifier.
 (neon_vld3_lanemode:VMQ): Likewise.
 (neon_vld3_dupmode:VDX): Likewise.
 (neon_vst3_lanemode:VD): Likewise.
 (neon_vst3_lanemode:VMQ): Likewise.


 PR target/54051
 * gcc.target/arm/pr54051.c: New.
 * gcc.target/arm/vfp-1.c: Adjust test.







RE: [PATCH][ARM][2/3] Add vectorization support for rounding functions

2013-02-05 Thread Kyrylo Tkachov
Ping?

Thanks,
Kyrill

 -Original Message-
 From: Kyrylo Tkachov [mailto:kyrylo.tkac...@arm.com]
 Sent: 07 January 2013 10:35
 To: Kyrylo Tkachov; gcc-patches@gcc.gnu.org
 Cc: Ramana Radhakrishnan; Richard Earnshaw
 Subject: RE: [PATCH][ARM][2/3] Add vectorization support for rounding
 functions
 
 Ping.
 
 http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01113.html
 
 Thanks,
 Kyrill
 
  -Original Message-
  From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-
  ow...@gcc.gnu.org] On Behalf Of Kyrylo Tkachov
  Sent: 18 December 2012 13:34
  To: gcc-patches@gcc.gnu.org
  Cc: Ramana Radhakrishnan; Richard Earnshaw
  Subject: [PATCH][ARM][2/3] Add vectorization support for rounding
  functions
 
  Hi all,
 
  This patch adds support for the vectorisation of the rounding
  functions:
  floorf, ceilf, truncf, roundf. These can be implemented using the
 ARMv8
  NEON
  instructions: vrintm, vrintp, vrintz, vrinta.
  This is done by defining the TARGET_VECTORIZE_BUILTINS and
  TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION macros and the function
  arm_builtin_vectorized_function that returns the decl of the vector
  form
  of a builtin function, or NULL_TREE if no vector variant exists.
 
  No regressions on arm-none-eabi with AEM.
 
  Ok for trunk?
 
  gcc/ChangeLog
 
  2012-12-18  Kyrylo Tkachov  kyrylo.tkachov at arm.com
 
  * config/arm/arm-protos.h (arm_builtin_vectorized_function):
New function prototype.
  * config/arm/arm.c (TARGET_VECTORIZE_BUILTINS): Define.
(TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION): Likewise.
(arm_builtin_vectorized_function): New function.





RE: [PATCH][ARM][1/3] Add vectorization support for rounding functions

2013-02-05 Thread Kyrylo Tkachov
Ping?

Thanks,
Kyrill

 -Original Message-
 From: Kyrylo Tkachov [mailto:kyrylo.tkac...@arm.com]
 Sent: 07 January 2013 10:35
 To: gcc-patches@gcc.gnu.org
 Cc: Ramana Radhakrishnan; Richard Earnshaw
 Subject: RE: [PATCH][ARM][1/3] Add vectorization support for rounding
 functions
 
 Ping.
 
 http://gcc.gnu.org/ml/gcc-patches/2012-12/msg0.html
 
 Thanks,
 Kyrill
 
  -Original Message-
  From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-
  ow...@gcc.gnu.org] On Behalf Of Kyrylo Tkachov
  Sent: 18 December 2012 13:33
  To: gcc-patches@gcc.gnu.org
  Cc: Ramana Radhakrishnan; Richard Earnshaw
  Subject: [PATCH][ARM][1/3] Add vectorization support for rounding
  functions
 
  Hi all,
 
  This patch does some refactoring by moving the definitions of the
 NEON
  builtins to a separate file (arm_neon_builtins.def) and includes that
  when
  initialising the neon_builtin_data array and also during
  the definition of enum arm_builtins (with appropriate redefinitions
 of
  the
  VAR* macros). This allows us to have symbolic names for the neon
  builtins
  that allows us to look up their declaration in
  arm_builtin_decls. This is needed for vectorisation support in the
 next
  patch. The ARM_BUILTIN_NEON_BASE constant which was defined as part
 of
  the
  arm_builtins enum is now defined as a macro, since
  various functions that deal with the initialisation and expansion of
  builtins use it.
 
  No regressions on arm-none-eabi with model.
 
  Ok for trunk?
 
  Thanks,
  Kyrill
 
 
  gcc/ChangeLog
 
  2012-12-18  Kyrylo Tkachov  kyrylo.tkachov at arm.com
 
  * config/arm/arm_neon_builtins.def: New file.
  * config/arm/arm.c (neon_builtin_data): Move contents to
arm_neon_builtins.def.
(enum arm_builtins): Include neon builtin definitions.
(ARM_BUILTIN_NEON_BASE): Move from enum to macro.





[PATCH] Enable SUPPORTS_INIT_PRIORITY on darwin

2013-02-05 Thread Jack Howarth
   Once the requested patch to extend qsorting of init priorities to 
destructors...

http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00154.html

is committed, the following patch enables SUPPORTS_INIT_PRIORITY on darwin. The
testsuite regression results are...

http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg00520.html

without and...

http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg00522.html

with SUPPORTS_INIT_PRIORITY enabled. Only the g++.dg/special/conpr-3.C 
execution test
fails as expected. The attached patch adds a dg-shouldfail on darwin for this 
testcase
as darwin lacks inter-module init priority support. With this patch, we will 
have the
same level of init priority support (ie only intra-modular) as clang. 
Regression tested
on x86_64-apple-darwin12. Okay for gcc trunk after the destructor qsorting patch
is committed?
Jack
/gcc

2013-02-05  Jack Howarth  howa...@bromo.med.uc.edu

* gcc/config/darwin.h: Enable SUPPORTS_INIT_PRIORITY.

/gcc/testsuite

2013-02-05  Jack Howarth  howa...@bromo.med.uc.edu

* g++.dg/special/conpr-3.C: Add dg-shouldfail on *-apple-darwin*.

Index: gcc/testsuite/g++.dg/special/conpr-3.C
===
--- gcc/testsuite/g++.dg/special/conpr-3.C  (revision 195747)
+++ gcc/testsuite/g++.dg/special/conpr-3.C  (working copy)
@@ -1,5 +1,6 @@
 /* { dg-do run { target init_priority } } */
 /* { dg-additional-sources conpr-3a.cc conpr-3b.cc } */
+/* { dg-shouldfail No inter-module priority support { *-apple-darwin* } } */
 
 #include stdlib.h
 
Index: gcc/config/darwin.h
===
--- gcc/config/darwin.h (revision 195747)
+++ gcc/config/darwin.h (working copy)
@@ -912,9 +912,8 @@ extern void darwin_driver_init (unsigned
   darwin_driver_init (decoded_options_count, decoded_options)
 #endif
 
-/* The Apple assembler and linker do not support constructor priorities.  */
-#undef SUPPORTS_INIT_PRIORITY
-#define SUPPORTS_INIT_PRIORITY 0
+/* While the Apple assembler and linker do not support constructor priorities,
+   intra-module priority support is available through sort_cdtor_records. */
 
 /* When building cross-compilers (and native crosses) we shall default to 
providing an osx-version-min of this unless overridden by the User.  */


[PATCH] Re-do fix for PR53185, maybe fix PR53342

2013-02-05 Thread Richard Biener

This re-does the fix for PR53185 in a less intrusive way, allowing
both strided load vectorization and peeling for alignment.  Testing
on my local machine tells me that this fix results in a 3% speedup
of rnflow.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2013-02-05  Richard Biener  rguent...@suse.de

PR tree-optimization/53342
PR tree-optimization/53185
* tree-vectorizer.h (vect_check_strided_load): Remove.
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Do
not disallow peeling for vectorized strided loads.
(vect_check_strided_load): Make static and simplify.
(vect_analyze_data_refs): Adjust.
* tree-vect-stmts.c (vectorizable_load): Handle peeled loops
correctly when vectorizing strided loads.

* gcc.dg/vect/pr53185-2.c: New testcase.

Index: gcc/tree-vectorizer.h
===
*** gcc/tree-vectorizer.h   (revision 195751)
--- gcc/tree-vectorizer.h   (working copy)
*** extern bool vect_analyze_data_ref_access
*** 923,929 
  extern bool vect_prune_runtime_alias_test_list (loop_vec_info);
  extern tree vect_check_gather (gimple, loop_vec_info, tree *, tree *,
   int *);
- extern bool vect_check_strided_load (gimple, loop_vec_info, tree *, tree *);
  extern bool vect_analyze_data_refs (loop_vec_info, bb_vec_info, int *);
  extern tree vect_create_data_ref_ptr (gimple, tree, struct loop *, tree,
  tree *, gimple_stmt_iterator *,
--- 923,928 
Index: gcc/tree-vect-data-refs.c
===
*** gcc/tree-vect-data-refs.c   (revision 195751)
--- gcc/tree-vect-data-refs.c   (working copy)
*** vect_enhance_data_refs_alignment (loop_v
*** 1615,1632 
 GROUP_FIRST_ELEMENT (stmt_info) != stmt)
  continue;
  
-   /* FORNOW: Any strided load prevents peeling.  The induction
-  variable analysis will fail when the prologue loop is generated,
-and so we can't generate the new base for the pointer.  */
-   if (STMT_VINFO_STRIDE_LOAD_P (stmt_info))
-   {
- if (dump_enabled_p ())
-   dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-  strided load prevents peeling);
- do_peeling = false;
- break;
-   }
- 
/* For invariant accesses there is nothing to enhance.  */
if (integer_zerop (DR_STEP (dr)))
continue;
--- 1615,1620 
*** vect_check_gather (gimple stmt, loop_vec
*** 2890,2898 
 This handles ARRAY_REFs (with variant index) and MEM_REFs (with variant
 base pointer) only.  */
  
! bool
! vect_check_strided_load (gimple stmt, loop_vec_info loop_vinfo, tree *basep,
!tree *stepp)
  {
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
--- 2878,2885 
 This handles ARRAY_REFs (with variant index) and MEM_REFs (with variant
 base pointer) only.  */
  
! static bool
! vect_check_strided_load (gimple stmt, loop_vec_info loop_vinfo)
  {
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
*** vect_check_strided_load (gimple stmt, lo
*** 2925,2934 
|| !simple_iv (loop, loop_containing_stmt (stmt), off, iv, true))
  return false;
  
-   if (basep)
- *basep = iv.base;
-   if (stepp)
- *stepp = iv.step;
return true;
  }
  
--- 2912,2917 
*** vect_analyze_data_refs (loop_vec_info lo
*** 3473,3480 
{
  bool strided_load = false;
  if (!nested_in_vect_loop_p (loop, stmt))
!   strided_load
! = vect_check_strided_load (stmt, loop_vinfo, NULL, NULL);
  if (!strided_load)
{
  if (dump_enabled_p ())
--- 3456,3462 
{
  bool strided_load = false;
  if (!nested_in_vect_loop_p (loop, stmt))
!   strided_load = vect_check_strided_load (stmt, loop_vinfo);
  if (!strided_load)
{
  if (dump_enabled_p ())
Index: gcc/tree-vect-stmts.c
===
*** gcc/tree-vect-stmts.c   (revision 195751)
--- gcc/tree-vect-stmts.c   (working copy)
*** vectorizable_load (gimple stmt, gimple_s
*** 4353,4359 
tree aggr_type;
tree gather_base = NULL_TREE, gather_off = NULL_TREE;
tree gather_off_vectype = NULL_TREE, gather_decl = NULL_TREE;
-   tree stride_base, stride_step;
int gather_scale = 1;
enum vect_def_type gather_dt = vect_unknown_def_type;
  
--- 4353,4358 
*** vectorizable_load (gimple stmt, gimple_s
*** 4462,4472 
}
  }
else if (STMT_VINFO_STRIDE_LOAD_P (stmt_info))
! {
!   if 

Fix inline-1.C and inline-3.C testcases

2013-02-05 Thread Jan Hubicka
Hi,
I managed to get an accidental commit on those two testcases without an 
ChangeLog entry.
I just commit the missing ChangeLog and the following patch that should make 
them pass.

just in a case you wonder what are the tests about. I disabled iteration on 
early inliner
that makes it to mis some cases of indirect inlining that are now handled by 
later
inliner. The tree-ssa/inline-?.C testcases tests that early inliner with large 
enough
iteration counts still does the optimization, while ipa/inline-?.C are the same
testcases with no iteration and test that late inline picks the optimization 
too.

The motivation for the change was early inliner doing funny things on 
non-trivial recursion
especially with early-inlining-insns bumped up.

My apologizes,
Honza

Index: g++.dg/tree-ssa/inline-3.C
===
--- g++.dg/tree-ssa/inline-3.C  (revision 195751)
+++ g++.dg/tree-ssa/inline-3.C  (working copy)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options -O2 -fdump-tree-einline --param 
max-early-inliner-iterations=3 } */
+/* { dg-options -O2 -fdump-tree-einline --param 
max-early-inliner-iterations=5 } */
 /* { dg-add-options bind_pic_locally } */
 
 #include algorithm
Index: g++.dg/ipa/inline-1.C
===
--- g++.dg/ipa/inline-1.C   (revision 195751)
+++ g++.dg/ipa/inline-1.C   (working copy)
@@ -31,6 +31,6 @@ int main(int argc, char **argv)
   foreach (argv, argv + argc, inline_me_too);
 }
 
-/* { dg-final { scan-tree-dump-times Considering void inline_me\\( 1 
inline} } */
-/* { dg-final { scan-tree-dump-times Considering void inline_me_too\\( 1 
inline} } */
-/* { dg-final { cleanup-tree-dump einline } } */
+/* { dg-final { scan-ipa-dump-times Considering void inline_me\\( 1 
inline} } */
+/* { dg-final { scan-ipa-dump-times Considering void inline_me_too\\( 1 
inline} } */
+/* { dg-final { cleanup-ipa-dump inline } } */


[PATCH] Fix up stdarg pass (PR tree-optimization/56205)

2013-02-05 Thread Jakub Jelinek
Hi!

The following testcase is miscompiled on ppc64, because the stdarg pass
didn't figure out that va_list was escaping.
The problem was that we've processed the
# z.2_31 = PHI z.2_27(11), z.2_24(12)
stmt was processed before processing z.2_27 and z.2_24 assignments,
so neither of them was in va_list_escape_vars at that point and so
z.2_31 wasn't added.  As we don't iterate in the first pass, we need
to just give up if we see this during check_all_va_list_escapes.
I don't think it happens often enough to warrant the need to iterate
instead.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2013-02-05  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/56205
* tree-stdarg.c (check_all_va_list_escapes): Return true if
there are any PHI nodes that set non-va_list_escape_vars SSA_NAME
and some va_list_escape_vars SSA_NAME appears in some PHI argument.

* gcc.dg/tree-ssa/stdarg-6.c: New test.
* gcc.c-torture/execute/pr56205.c: New test.

--- gcc/tree-stdarg.c.jj2013-01-11 09:02:48.0 +0100
+++ gcc/tree-stdarg.c   2013-02-05 10:47:13.292700397 +0100
@@ -526,6 +526,37 @@ check_all_va_list_escapes (struct stdarg
 {
   gimple_stmt_iterator i;
 
+  for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (i))
+   {
+ tree lhs;
+ use_operand_p uop;
+ ssa_op_iter soi;
+ gimple phi = gsi_stmt (i);
+
+ lhs = PHI_RESULT (phi);
+ if (virtual_operand_p (lhs)
+ || bitmap_bit_p (si-va_list_escape_vars,
+  SSA_NAME_VERSION (lhs)))
+   continue;
+
+ FOR_EACH_PHI_ARG (uop, phi, soi, SSA_OP_USE)
+   {
+ tree rhs = USE_FROM_PTR (uop);
+ if (TREE_CODE (rhs) == SSA_NAME
+  bitmap_bit_p (si-va_list_escape_vars,
+   SSA_NAME_VERSION (rhs)))
+   {
+ if (dump_file  (dump_flags  TDF_DETAILS))
+   {
+ fputs (va_list escapes in , dump_file);
+ print_gimple_stmt (dump_file, phi, 0, dump_flags);
+ fputc ('\n', dump_file);
+   }
+ return true;
+   }
+   }
+   }
+
   for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (i))
{
  gimple stmt = gsi_stmt (i);
--- gcc/testsuite/gcc.dg/tree-ssa/stdarg-6.c.jj 2013-02-05 11:01:37.518935765 
+0100
+++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-6.c2013-02-05 11:15:01.511610919 
+0100
@@ -0,0 +1,35 @@
+/* PR tree-optimization/56205 */
+/* { dg-do compile } */
+/* { dg-options -O3 -fdump-tree-stdarg } */
+
+#include stdarg.h
+
+int a, b;
+char c[128];
+
+static inline void
+foo (int x, char const *y, va_list z)
+{
+  __builtin_printf (%s %d %s, x ?  : foo, ++a, (y  *y) ? bar : );
+  if (y  *y)
+__builtin_vprintf (y, z);
+}
+
+void
+bar (int x, char const *y, ...)
+{
+  va_list z;
+  va_start (z, y);
+  if (!x  *c == '\0')
+++b;
+  foo (x, y, z);
+  va_end (z);
+}
+
+/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all GPR 
units and all FPR units stdarg { target { { i?86-*-* x86_64-*-* }  { ! { 
ia32 } } } } } } */
+/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all GPR 
units and all FPR units stdarg { target { powerpc*-*-linux*  ilp32 } } } } 
*/
+/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all GPR 
units and all FPR units stdarg { target alpha*-*-linux* } } } */
+/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all GPR 
units and all FPR units stdarg { target s390*-*-linux* } } } */
+/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all GPR 
units stdarg { target { { i?86-*-* x86_64-*-* }  ia32 } } } } */
+/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all GPR 
units stdarg { target ia64-*-* } } } */
+/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all GPR 
units stdarg { target { powerpc*-*-*  lp64 } } } } */
--- gcc/testsuite/gcc.c-torture/execute/pr56205.c.jj2013-02-05 
11:36:30.693183702 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr56205.c   2013-02-05 
11:34:34.0 +0100
@@ -0,0 +1,61 @@
+/* PR tree-optimization/56205 */
+
+#include stdarg.h
+
+int a, b;
+char c[128];
+
+__attribute__((noinline, noclone)) static void
+f1 (const char *fmt, ...)
+{
+  va_list ap;
+  asm volatile ( : : : memory);
+  if (__builtin_strcmp (fmt, %s %d %s) != 0)
+__builtin_abort ();
+  va_start (ap, fmt);
+  if (__builtin_strcmp (va_arg (ap, const char *), foo) != 0
+  || va_arg (ap, int) != 1
+  || __builtin_strcmp (va_arg (ap, const char *), bar) != 0)
+__builtin_abort ();
+  va_end (ap);
+}
+
+__attribute__((noinline, noclone)) static void
+f2 (const char *fmt, va_list ap)
+{
+  asm volatile ( : : : memory);
+  if (__builtin_strcmp (fmt, baz) != 0
+  || __builtin_strcmp 

[PATCH] Treat -ltsan similarly to -lasan during linking (PR sanitizer/55374)

2013-02-05 Thread Jakub Jelinek
Hi!

This patch adjusts -fsanitize=thread linking behavior to match that
of -fsanitize=address, in that -ltsan is also linked early on the link
command line, -ldl -lpthread is added on Linux, etc.
Additionally, for -nostdlib or -nodefaultlibs this patch doesn't
add -lasan nor -ltsan nor its dependencies, it is user's responsibility.
The only important difference between -fsanitize=address and
-fsanitize=thread is that while the former only rejects -static link,
the latter (as it requires PIEs right now) only allows -shared or -pie
links.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2013-02-05  Jakub Jelinek  ja...@redhat.com

PR sanitizer/55374
* config/gnu-user.h (LIBTSAN_EARLY_SPEC): Define.
(STATIC_LIBTSAN_LIBS): Likewise.
* gcc.c (ADD_STATIC_LIBTSAN_LIBS, LIBTSAN_EARLY_SPEC): Define.
(LIBTSAN_SPEC): Add ADD_STATIC_LIBTSAN_LIBS, if LIBTSAN_EARLY_SPEC
is defined, don't add anything else beyond that.
(SANITIZER_EARLY_SPEC, SANITIZER_SPEC): Define.
(LINK_COMMAND_SPEC): Use them.

--- gcc/config/gnu-user.h.jj2013-02-05 12:06:08.0 +0100
+++ gcc/config/gnu-user.h   2013-02-05 12:45:44.707178024 +0100
@@ -101,14 +101,22 @@ see the files COPYING3 and COPYING.RUNTI
 /* Link -lasan early on the command line.  For -static-libasan, don't link
it for -shared link, the executable should be compiled with -static-libasan
in that case, and for executable link link with --{,no-}whole-archive around
-   it to force everything into the executable.  */
+   it to force everything into the executable.  And similarly for -ltsan.  */
 #if defined(HAVE_LD_STATIC_DYNAMIC)
 #undef LIBASAN_EARLY_SPEC
 #define LIBASAN_EARLY_SPEC %{static-libasan:%{!shared: \
   LD_STATIC_OPTION  --whole-archive -lasan --no-whole-archive  \
   LD_DYNAMIC_OPTION }}%{!static-libasan:-lasan}
+#undef LIBTSAN_EARLY_SPEC
+#define LIBTSAN_EARLY_SPEC %{static-libtsan:%{!shared: \
+  LD_STATIC_OPTION  --whole-archive -ltsan --no-whole-archive  \
+  LD_DYNAMIC_OPTION }}%{!static-libtsan:-ltsan}
 #endif
 
 /* Additional libraries needed by -static-libasan.  */
 #undef STATIC_LIBASAN_LIBS
 #define STATIC_LIBASAN_LIBS -ldl -lpthread
+
+/* Additional libraries needed by -static-libtsan.  */
+#undef STATIC_LIBTSAN_LIBS
+#define STATIC_LIBTSAN_LIBS -ldl -lpthread
--- gcc/gcc.c.jj2013-01-30 19:05:06.0 +0100
+++ gcc/gcc.c   2013-02-05 12:56:37.539108130 +0100
@@ -564,14 +564,27 @@ proper position among the other output f
 #endif
 
 #ifndef LIBTSAN_SPEC
-#ifdef HAVE_LD_STATIC_DYNAMIC
+#ifdef STATIC_LIBTSAN_LIBS
+#define ADD_STATIC_LIBTSAN_LIBS \
+   %{static-libtsan: STATIC_LIBTSAN_LIBS }
+#else
+#define ADD_STATIC_LIBTSAN_LIBS
+#endif
+#ifdef LIBTSAN_EARLY_SPEC
+#define LIBTSAN_SPEC ADD_STATIC_LIBTSAN_LIBS
+#elif defined(HAVE_LD_STATIC_DYNAMIC)
 #define LIBTSAN_SPEC %{static-libtsan: LD_STATIC_OPTION \
-} -ltsan %{static-libtsan: LD_DYNAMIC_OPTION }
+} -ltsan %{static-libtsan: LD_DYNAMIC_OPTION } \
+ADD_STATIC_LIBTSAN_LIBS
 #else
-#define LIBTSAN_SPEC -ltsan
+#define LIBTSAN_SPEC -ltsan ADD_STATIC_LIBTSAN_LIBS
 #endif
 #endif
 
+#ifndef LIBTSAN_EARLY_SPEC
+#define LIBTSAN_EARLY_SPEC 
+#endif
+
 /* config.h can define LIBGCC_SPEC to override how and when libgcc.a is
included.  */
 #ifndef LIBGCC_SPEC
@@ -691,6 +704,21 @@ proper position among the other output f
 %e-fuse-linker-plugin is not supported in this configuration}
 #endif

+/* Linker command line options for -fsanitize= early on the command line.  */
+#ifndef SANITIZER_EARLY_SPEC
+#define SANITIZER_EARLY_SPEC \
+%{!nostdlib:%{!nodefaultlibs:%{fsanitize=address: LIBASAN_EARLY_SPEC } \
+%{fsanitize=thread: LIBTSAN_EARLY_SPEC }}}
+#endif
+
+/* Linker command line options for -fsanitize= late on the command line.  */
+#ifndef SANITIZER_SPEC
+#define SANITIZER_SPEC \
+%{!nostdlib:%{!nodefaultlibs:%{fsanitize=address: LIBASAN_SPEC \
+%{static:%ecannot specify -static with -fsanitize=address}}\
+%{fsanitize=thread: LIBTSAN_SPEC \
+%{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or 
-shared}
+#endif
 
 /* -u* was put back because both BSD and SysV seem to support it.  */
 /* %{static:} simply prevents an error message if the target machine
@@ -706,19 +734,16 @@ proper position among the other output f
 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
 %(linker)  \
 LINK_PLUGIN_SPEC \
-%{flto|flto=*:%fcompare-debug*} \
+   %{flto|flto=*:%fcompare-debug*} \
 %{flto} %{flto=*} %l  LINK_PIE_SPEC \
%{fuse-ld=*:-fuse-ld=%*}\
 %X %{o*} %{e*} %{N} %{n} %{r}\
 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
-%{static:} %{L*} %(mfwrap) %(link_libgcc) \
-%{fsanitize=address: LIBASAN_EARLY_SPEC } %o\
+%{static:} %{L*} %(mfwrap) %(link_libgcc)  SANITIZER_EARLY_SPEC  %o\
 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
   

Re: [PATCH] Fix up stdarg pass (PR tree-optimization/56205)

2013-02-05 Thread Richard Biener
On Tue, 5 Feb 2013, Jakub Jelinek wrote:

 Hi!
 
 The following testcase is miscompiled on ppc64, because the stdarg pass
 didn't figure out that va_list was escaping.
 The problem was that we've processed the
 # z.2_31 = PHI z.2_27(11), z.2_24(12)
 stmt was processed before processing z.2_27 and z.2_24 assignments,
 so neither of them was in va_list_escape_vars at that point and so
 z.2_31 wasn't added.  As we don't iterate in the first pass, we need
 to just give up if we see this during check_all_va_list_escapes.
 I don't think it happens often enough to warrant the need to iterate
 instead.
 
 Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

 2013-02-05  Jakub Jelinek  ja...@redhat.com
 
   PR tree-optimization/56205
   * tree-stdarg.c (check_all_va_list_escapes): Return true if
   there are any PHI nodes that set non-va_list_escape_vars SSA_NAME
   and some va_list_escape_vars SSA_NAME appears in some PHI argument.
 
   * gcc.dg/tree-ssa/stdarg-6.c: New test.
   * gcc.c-torture/execute/pr56205.c: New test.
 
 --- gcc/tree-stdarg.c.jj  2013-01-11 09:02:48.0 +0100
 +++ gcc/tree-stdarg.c 2013-02-05 10:47:13.292700397 +0100
 @@ -526,6 +526,37 @@ check_all_va_list_escapes (struct stdarg
  {
gimple_stmt_iterator i;
  
 +  for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (i))
 + {
 +   tree lhs;
 +   use_operand_p uop;
 +   ssa_op_iter soi;
 +   gimple phi = gsi_stmt (i);
 +
 +   lhs = PHI_RESULT (phi);
 +   if (virtual_operand_p (lhs)
 +   || bitmap_bit_p (si-va_list_escape_vars,
 +SSA_NAME_VERSION (lhs)))
 + continue;
 +
 +   FOR_EACH_PHI_ARG (uop, phi, soi, SSA_OP_USE)
 + {
 +   tree rhs = USE_FROM_PTR (uop);
 +   if (TREE_CODE (rhs) == SSA_NAME
 +bitmap_bit_p (si-va_list_escape_vars,
 + SSA_NAME_VERSION (rhs)))
 + {
 +   if (dump_file  (dump_flags  TDF_DETAILS))
 + {
 +   fputs (va_list escapes in , dump_file);
 +   print_gimple_stmt (dump_file, phi, 0, dump_flags);
 +   fputc ('\n', dump_file);
 + }
 +   return true;
 + }
 + }
 + }
 +
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (i))
   {
 gimple stmt = gsi_stmt (i);
 --- gcc/testsuite/gcc.dg/tree-ssa/stdarg-6.c.jj   2013-02-05 
 11:01:37.518935765 +0100
 +++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-6.c  2013-02-05 11:15:01.511610919 
 +0100
 @@ -0,0 +1,35 @@
 +/* PR tree-optimization/56205 */
 +/* { dg-do compile } */
 +/* { dg-options -O3 -fdump-tree-stdarg } */
 +
 +#include stdarg.h
 +
 +int a, b;
 +char c[128];
 +
 +static inline void
 +foo (int x, char const *y, va_list z)
 +{
 +  __builtin_printf (%s %d %s, x ?  : foo, ++a, (y  *y) ? bar : );
 +  if (y  *y)
 +__builtin_vprintf (y, z);
 +}
 +
 +void
 +bar (int x, char const *y, ...)
 +{
 +  va_list z;
 +  va_start (z, y);
 +  if (!x  *c == '\0')
 +++b;
 +  foo (x, y, z);
 +  va_end (z);
 +}
 +
 +/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all 
 GPR units and all FPR units stdarg { target { { i?86-*-* x86_64-*-* }  { 
 ! { ia32 } } } } } } */
 +/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all 
 GPR units and all FPR units stdarg { target { powerpc*-*-linux*  ilp32 } 
 } } } */
 +/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all 
 GPR units and all FPR units stdarg { target alpha*-*-linux* } } } */
 +/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all 
 GPR units and all FPR units stdarg { target s390*-*-linux* } } } */
 +/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all 
 GPR units stdarg { target { { i?86-*-* x86_64-*-* }  ia32 } } } } */
 +/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all 
 GPR units stdarg { target ia64-*-* } } } */
 +/* { dg-final { scan-tree-dump bar: va_list escapes 1, needs to save all 
 GPR units stdarg { target { powerpc*-*-*  lp64 } } } } */
 --- gcc/testsuite/gcc.c-torture/execute/pr56205.c.jj  2013-02-05 
 11:36:30.693183702 +0100
 +++ gcc/testsuite/gcc.c-torture/execute/pr56205.c 2013-02-05 
 11:34:34.0 +0100
 @@ -0,0 +1,61 @@
 +/* PR tree-optimization/56205 */
 +
 +#include stdarg.h
 +
 +int a, b;
 +char c[128];
 +
 +__attribute__((noinline, noclone)) static void
 +f1 (const char *fmt, ...)
 +{
 +  va_list ap;
 +  asm volatile ( : : : memory);
 +  if (__builtin_strcmp (fmt, %s %d %s) != 0)
 +__builtin_abort ();
 +  va_start (ap, fmt);
 +  if (__builtin_strcmp (va_arg (ap, const char *), foo) != 0
 +  || va_arg (ap, int) != 1
 +  || __builtin_strcmp (va_arg (ap, const char *), bar) != 0)
 +__builtin_abort ();
 +  va_end (ap);
 +}
 +
 +__attribute__((noinline, noclone)) static void
 +f2 

[PATCH] Remove unused tree_decl_with_vis field - thread_local

2013-02-05 Thread Jakub Jelinek
Hi!

Got a bugreport that gcc plugins can't be compiled with -std=c++11,
seems the reason why not is badly named bitfield that is never used
anyway.  From what I've seen in CVS history, thread_local_flag
was first removed by
2005-06-30  Steven Bosscher  stev...@suse.de

* tree.h (struct tree_decl): New field `tls_model'.
(DECL_TLS_MODEL): New.
(DECL_THREAD_LOCAL_P): Rename from DECL_THREAD_LOCAL, make it
a predicate.
(DECL_THREAD_LOCAL_P tests tls_model since then), but later on reappeared
2005-07-08  Daniel Berlin  dber...@dberlin.org

...
(struct tree_decl_minimal): New structure.
(struct tree_decl_common): Ditto.
(struct tree_decl_with_rtl): Ditto.
(struct tree_decl_with_vis): Ditto.
supposedly because that patch has been written already before the 2005-06-30
change and didn't take the removal into account properly.

So, this patch just removes that unused bitfield.
Ok for trunk?

2013-02-05  Jakub Jelinek  ja...@redhat.com

* tree.h (struct tree_decl_with_vis): Remove thread_local field.

--- gcc/tree.h.jj   2013-01-11 09:02:33.0 +0100
+++ gcc/tree.h  2013-02-05 15:27:30.331437092 +0100
@@ -3198,13 +3198,14 @@ struct GTY(()) tree_decl_with_vis {
  /* Belong to VAR_DECL exclusively.  */
  unsigned defer_output : 1;
  unsigned hard_register : 1;
- unsigned thread_local : 1;
  unsigned common_flag : 1;
  unsigned in_text_section : 1;
  unsigned in_constant_pool : 1;
  unsigned dllimport_flag : 1;
  /* Don't belong to VAR_DECL exclusively.  */
  unsigned weak_flag : 1;
+ /* When SECTION_NAME is implied by -ffunction-section.  */
+ unsigned implicit_section_name_p : 1;
 
  unsigned seen_in_bind_expr : 1;
  unsigned comdat_flag : 1;
@@ -3217,9 +3218,7 @@ struct GTY(()) tree_decl_with_vis {
  unsigned init_priority_p : 1;
  /* Used by C++ only.  Might become a generic decl flag.  */
  unsigned shadowed_for_var_p : 1;
- /* When SECTION_NAME is implied by -ffunsection-section.  */
- unsigned implicit_section_name_p : 1;
- /* 13 unused bits. */
+ /* 14 unused bits. */
 };
 
 extern tree decl_debug_expr_lookup (tree);

Jakub


Re: Fix PR 53743 and other -freorder-blocks-and-partition failures (issue6823047)

2013-02-05 Thread Teresa Johnson
Thanks for the confirmation that the -g issue is orthogonal. I did
start to try to address it but got pulled away by some other things
for awhile. I'll see if I can take another stab at it.

In the meantime, could one of the global maintainers take a look at
the patch? I don't want it to get too stale, and without these fixes I
am unable to get -freorder-blocks-and-partition to work at all.

Thanks!
Teresa

On Thu, Jan 31, 2013 at 6:18 AM, Christophe Lyon
christophe.l...@linaro.org wrote:
 Hello,

 Sorry for the long delay (ref http://patchwork.ozlabs.org/patch/199397/)



 On 6 December 2012 20:26, Teresa Johnson tejohn...@google.com wrote:



 On Wed, Nov 28, 2012 at 7:48 AM, Christophe Lyon
 christophe.l...@linaro.org wrote:

 I have updated my trunk checkout, and I can confirm that eval.c now
 compiles with your patch (and the other 4 patches I added to PR55121).


 good



 Now, when looking at the whole Spec2k results:
 - vpr passes now (used to fail)


 good


 - gcc, parser, perlbmk bzip2 and twolf no longer build: they all fail
 with the same error from gas:
 can't resolve `.text.unlikely' {.text.unlikely section} - `.LBB171'
 {.text section}
 - gap still does not build (same error as above)

 I haven't looked in detail, so I may be missing an obvious patch here.


 Finally had a chance to get back to this. I was able to reproduce the
 failure using x86_64 linux with -freorder-blocks-and-partition -g.
 However, I am also getting the same failure with a pristine copy of trunk.
 Can you confirm whether you were seeing any of these failures without my
 patches, because I believe they are probably a limitation with function
 splitting and debug info that is orthogonal to my patch.

 Yes I confirm that I see these failures without your patch too; and
 both -freorder-blocks-and-partition and -g are present in my
 command-line.
 And now gap's integer.c fails to compile with a similar error message too.


 And I still observe runtime mis-behaviour on crafty, galgel, facerec and
 fma3d.


 I'm not seeing this on x86_64, unfortunately, so it might require some
 follow-on work to triage and fix.

 I'll look into the gas failure, but if someone could review this patch in
 the meantime given that it does improve things considerably (at least
 without -g), that would be great.

 Indeed.

 Thanks,
 Teresa


 Thanks
 Christophe



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


Re: [PATCH] Remove unused tree_decl_with_vis field - thread_local

2013-02-05 Thread Richard Biener
On Tue, 5 Feb 2013, Jakub Jelinek wrote:

 Hi!
 
 Got a bugreport that gcc plugins can't be compiled with -std=c++11,
 seems the reason why not is badly named bitfield that is never used
 anyway.  From what I've seen in CVS history, thread_local_flag
 was first removed by
 2005-06-30  Steven Bosscher  stev...@suse.de
 
 * tree.h (struct tree_decl): New field `tls_model'.
 (DECL_TLS_MODEL): New.
 (DECL_THREAD_LOCAL_P): Rename from DECL_THREAD_LOCAL, make it
 a predicate.
 (DECL_THREAD_LOCAL_P tests tls_model since then), but later on reappeared
 2005-07-08  Daniel Berlin  dber...@dberlin.org
 
 ...
 (struct tree_decl_minimal): New structure.
 (struct tree_decl_common): Ditto.
 (struct tree_decl_with_rtl): Ditto.
 (struct tree_decl_with_vis): Ditto.
 supposedly because that patch has been written already before the 2005-06-30
 change and didn't take the removal into account properly.
 
 So, this patch just removes that unused bitfield.
 Ok for trunk?

Ok.

Thanks,
Richard.

 2013-02-05  Jakub Jelinek  ja...@redhat.com
 
   * tree.h (struct tree_decl_with_vis): Remove thread_local field.
 
 --- gcc/tree.h.jj 2013-01-11 09:02:33.0 +0100
 +++ gcc/tree.h2013-02-05 15:27:30.331437092 +0100
 @@ -3198,13 +3198,14 @@ struct GTY(()) tree_decl_with_vis {
   /* Belong to VAR_DECL exclusively.  */
   unsigned defer_output : 1;
   unsigned hard_register : 1;
 - unsigned thread_local : 1;
   unsigned common_flag : 1;
   unsigned in_text_section : 1;
   unsigned in_constant_pool : 1;
   unsigned dllimport_flag : 1;
   /* Don't belong to VAR_DECL exclusively.  */
   unsigned weak_flag : 1;
 + /* When SECTION_NAME is implied by -ffunction-section.  */
 + unsigned implicit_section_name_p : 1;
  
   unsigned seen_in_bind_expr : 1;
   unsigned comdat_flag : 1;
 @@ -3217,9 +3218,7 @@ struct GTY(()) tree_decl_with_vis {
   unsigned init_priority_p : 1;
   /* Used by C++ only.  Might become a generic decl flag.  */
   unsigned shadowed_for_var_p : 1;
 - /* When SECTION_NAME is implied by -ffunsection-section.  */
 - unsigned implicit_section_name_p : 1;
 - /* 13 unused bits. */
 + /* 14 unused bits. */
  };
  
  extern tree decl_debug_expr_lookup (tree);
 
   Jakub
 
 

-- 
Richard Biener rguent...@suse.de
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend


Re: [PATCH] Treat -ltsan similarly to -lasan during linking (PR sanitizer/55374)

2013-02-05 Thread Dodji Seketeli
Jakub Jelinek ja...@redhat.com writes:


 Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

 2013-02-05  Jakub Jelinek  ja...@redhat.com

   PR sanitizer/55374
   * config/gnu-user.h (LIBTSAN_EARLY_SPEC): Define.
   (STATIC_LIBTSAN_LIBS): Likewise.
   * gcc.c (ADD_STATIC_LIBTSAN_LIBS, LIBTSAN_EARLY_SPEC): Define.
   (LIBTSAN_SPEC): Add ADD_STATIC_LIBTSAN_LIBS, if LIBTSAN_EARLY_SPEC
   is defined, don't add anything else beyond that.
   (SANITIZER_EARLY_SPEC, SANITIZER_SPEC): Define.
   (LINK_COMMAND_SPEC): Use them.

It looks OK for me.  Thanks!

-- 
Dodji


Re: Fix inline-1.C and inline-3.C testcases

2013-02-05 Thread Jakub Jelinek
On Tue, Feb 05, 2013 at 04:27:15PM +0100, Jan Hubicka wrote:
 I managed to get an accidental commit on those two testcases without an 
 ChangeLog entry.
 I just commit the missing ChangeLog and the following patch that should make 
 them pass.
 
 just in a case you wonder what are the tests about. I disabled iteration on 
 early inliner
 that makes it to mis some cases of indirect inlining that are now handled by 
 later
 inliner. The tree-ssa/inline-?.C testcases tests that early inliner with 
 large enough
 iteration counts still does the optimization, while ipa/inline-?.C are the 
 same
 testcases with no iteration and test that late inline picks the optimization 
 too.
 
 The motivation for the change was early inliner doing funny things on 
 non-trivial recursion
 especially with early-inlining-insns bumped up.

Doesn't seem to be enough.

gcc/testsuite/g++.dg/ipa/inline-3.C
has
/* { dg-final { cleanup-tree-dump inline } } */
while supposedly it should have:
/* { dg-final { cleanup-ipa-dump inline } } */

Also,
gcc/testsuite/gcc.dg/tree-ssa/inline-3.c
is now failing, supposedly it should have --param added ?

Jakub


Re: [PATCH] Add missing explicit instantiation for std::lower_bound template

2013-02-05 Thread Paolo Carlini

Hi Dodji,

On 02/04/2013 04:53 PM, Dodji Seketeli wrote:

Hello,

Since commit r195676[1], it looks like
libstdc++-v3/src/c++11/hashtable_c++0x.cc is missing an explicit
instantiation for std::lower_bound.  This leads to libstdc++.so having
the symbol for that (missing) instantiation be undefined, thus
preventing executables from being linked with libstdc++.
Note that I can confirm this only if I build with less optimization than 
the default -O2, say -O. That may explain why nobody noticed earlier.

The patchlet below seems to fixed the issue for me.


Indeed, I think we want something like that. Thanks. In terms of nits, 
formatting and types (who knows, maybe on some systems a std::size_t is 
an unsigned long long), I would write something like the attached. 
Please double check that it works for you and go ahead.


Thanks again,
Paolo.

//


Index: hashtable_c++0x.cc
===
--- hashtable_c++0x.cc  (revision 195759)
+++ hashtable_c++0x.cc  (working copy)
@@ -94,4 +94,11 @@ namespace __detail
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace __detail
+
+  // Instantiation.
+  template
+  const unsigned long*
+  lower_boundconst unsigned long*, size_t(const unsigned long*,
+   const unsigned long*,
+   const size_t);
 } // namespace std


New Esperanto PO file for 'cpplib' (version 4.7.2)

2013-02-05 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

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

http://translationproject.org/latest/cpplib/eo.po

(This file, 'cpplib-4.7.2.eo.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/cpplib/

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

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

The following HTML page has been updated:

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

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.
coordina...@translationproject.org



Contents of PO file 'cpplib-4.7.2.eo.po'

2013-02-05 Thread Translation Project Robot


cpplib-4.7.2.eo.po.gz
Description: Binary data
The Translation Project robot, in the
name of your translation coordinator.
coordina...@translationproject.org


[PATCH][ARM] Implement vectorizer cost hooks

2013-02-05 Thread Christophe Lyon
Hi,

Following the discussion about disable peeling [1] a few weeks ago,
it turned out that the vectorizer cost model needed some
implementation for ARM.

The attached patch implements arm_builtin_vectorization_cost and
arm_add_stmt_cost, providing default costs when aligned and unaligned
loads/stores have the same cost (=1). init_cost and finish_cost still
use the default implementation (I noticed that x86 has chosen to
duplicate the default implementation without changing it, why?)

Benchmarking shows very little variation, expect a noticeable +1.6% on coremark.

If this is OK, we can then discuss how to disable peeling completely
when aligned and unaligned accesses have the same cost (and thus where
peeling is a loss of performance). I think adding a new hook is
necessary, since target descriptions may use different models for
these costs (eg x86 makes no difference between unaligned loads and
unaligned stores).

Thanks,

Christophe.

[1] http://gcc.gnu.org/ml/gcc/2012-12/msg00036.html

2013-02-05  Christophe Lyon christophe.l...@linaro.org

* config/arm/arm.c (arm_builtin_vectorization_cost)
(arm_add_stmt_cost): New functions.
(TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST)
(TARGET_VECTORIZE_ADD_STMT_COST): Define.
(struct processor_costs): New struct type.
(default_arm_cost): New struct of type processor_costs.


vect-cost-model.patch
Description: Binary data


New Esperanto PO file for 'cpplib' (version 4.7.2)

2013-02-05 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

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

http://translationproject.org/latest/cpplib/eo.po

(This file, 'cpplib-4.7.2.eo.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/cpplib/

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

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

The following HTML page has been updated:

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

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.
coordina...@translationproject.org



Contents of PO file 'cpplib-4.7.2.eo.po'

2013-02-05 Thread Translation Project Robot


cpplib-4.7.2.eo.po.gz
Description: Binary data
The Translation Project robot, in the
name of your translation coordinator.
coordina...@translationproject.org


Re: [PATCH] GCC 4.9 powerpc, merge SF/SD moves

2013-02-05 Thread David Edelsohn
On Wed, Jan 30, 2013 at 1:36 PM, Michael Meissner
meiss...@linux.vnet.ibm.com wrote:
 This is a series of patches taken from my power8 work meant for inclusion
 against GCC 4.9 when 4.8 is branched, and stage1 of 4.9 opens up again.  They
 could be installed in 4.8 at the discretion of David.

 This patch merges together the movsd/movsf patterns, so that when I make
 changes to the basic move patterns, I don't have to remember to do the same
 work in two places.

 Along with combining the moves, I added support to use the LFIWZX (power7) and
 STFIWX (power6) instructions to store SDmode variables directly.  Before this,
 we needed to create a wider buffer on the stack, and move the values from
 a register to the buffer, and use a wider load on the floating point side to
 load them up.  Now under power7, it no longer uses this buffer.

 A minor other change is that now the compiler will use the VSX XXLXOR
 instruction to clear a single precision floating point value, instead of
 loading the zero value from memory.

 I have bootstraped, and there are no regressions with these patches.  Are 
 these
 patches acceptible, so that I can check them in directly when the GCC 4.9 tree
 opens up?

 [gcc]
 2013-01-30  Michael Meissner  meiss...@linux.vnet.ibm.com

 * config/rs6000/vector.md (VEC_R): Add 32-bit integer, binary
 floating point, and decimal floating point to reload iterator.

 * config/rs6000/constraints.md (wl constraint): New constraints to
 return FLOAT_REGS if certain options are used to reduce the number
 of separate patterns that exist in the file.
 (wx constraint): Likewise.
 (wz constraint): Likewise.

 * config/rs6000/rs6000.c (rs6000_debug_reg_global): If
 -mdebug=reg, print wg, wl, wx, and wz constraints.
 (rs6000_init_hard_regno_mode_ok): Initialize new constraints.
 Initialize the reload functions for 64-bit binary/decimal floating
 point types.
 (reg_offset_addressing_ok_p): If we are on a power7 or later, use
 LFIWZX and STFIWX to load/store 32-bit decimal types, and don't
 create the buffer on the stack to overcome not having a 32-bit
 load and store.
 (rs6000_emit_move): Likewise.
 (rs6000_secondary_memory_needed_rtx): Likewise.
 (rs6000_alloc_sdmode_stack_slot): Likewise.
 (rs6000_preferred_reload_class): On VSX, we can create SFmode 0.0f
 via xxlxor, just like DFmode 0.0.

 * config/rs6000/rs6000.h (TARGET_NO_SDMODE_STACK): New macro,
 define as 1 if we are running on a power7 or newer.
 (enum r6000_reg_class_enum): Add new constraints.

 * config/rs6000/dfp.md (movsd): Delete, combine with binary
 floating point moves in rs6000.md.  Combine power6x (mfpgpr) moves
 with other moves by using conditional constraits (wg).  Use LFIWZX
 and STFIWX for loading SDmode on power7.  Use xxlxor to create
 0.0f.
 (movsd splitter): Likewise.
 (movsd_hardfloat): Likewise.
 (movsd_softfloat): Likewise.

 * config/rs6000/rs6000.md (FMOVE32): New iterators to combine
 binary and decimal floating point moves.
 (fmove_ok): New attributes to combine binary and decimal floating
 point moves, and to combine power6x (mfpgpr) moves along normal
 floating moves.
 (real_value_to_target): Likewise.
 (f32_lr): Likewise.
 (f32_lm): Likewise.
 (f32_li): Likewise.
 (f32_sr): Likewise.
 (f32_sm): Likewise.
 (f32_si): Likewise.
 (movsf): Combine binary and decimal floating point moves.  Combine
 power6x (mfpgpr) moves with other moves by using conditional
 constraits (wg).  Use LFIWZX and STFIWX for loading SDmode on
 power7.
 (movmode for SFmode/SDmode); Likewise.
 (SFmode/SDmode splitters): Likewise.
 (movsf_hardfloat): Likewise.
 (movmode_hardfloat for SFmode/SDmode): Likewise.
 (movsf_softfloat): Likewise.
 (movmode_softfloat for SFmode/SDmode): Likewise.

 * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wl,
 wx and wz constraints.

 [gcc/testsuite]
 2013-01-30  Michael Meissner  meiss...@linux.vnet.ibm.com

 * gcc.target/powerpc/vsx-float0.c: New testcase.
 * gcc.target/powerpc/sd-vsx.c: Likewise.
 * gcc.target/powerpc/sd-pwr6.c: Likewise.

This patch is okay when 4.9 tree opens, but please confirm that the
code paths work correctly for pre-POWER7 systems.

Thanks, David


Re: [PATCH] GCC 4.9 powerpc, merge DF/DD moves

2013-02-05 Thread David Edelsohn
On Wed, Jan 30, 2013 at 3:48 PM, Michael Meissner
meiss...@linux.vnet.ibm.com wrote:
 This patch builds upon the patch in:
 http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01457.html

 It merges the DFmode and DDmode moves into one pattern.  In addition, it 
 merges
 the -mmfpgpr code with the normal floating point moves, using a new 
 conditional
 constraint (wg) that only returns FLOAT_REGS for the power6x.

 I have tested this via bootstrap, and there were no regressions.  Is patch
 acceptable to check in when the 4.9 tree opens up?

 2013-01-30  Michael Meissner  meiss...@linux.vnet.ibm.com

 * config/rs6000/constraints.md (wg constraint): New constraint to
 return FLOAT_REGS if -mmfpgpr (power6x) was used.

 * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add wg
 constraint.

 * config/rs6000/rs6000.c (rs6000_debug_reg_global): If
 -mdebug=reg, print wg, wl, wx, and wz constraints.
 (rs6000_init_hard_regno_mode_ok): Initialize new constraints.
 Initialize the reload functions for 64-bit binary/decimal floating
 point types.
 (reg_offset_addressing_ok_p): If we are on a power7 or later, use
 LFIWZX and STFIWX to load/store 32-bit decimal types, and don't
 create the buffer on the stack to overcome not having a 32-bit
 load and store.
 (rs6000_emit_move): Likewise.
 (rs6000_secondary_memory_needed_rtx): Likewise.
 (rs6000_alloc_sdmode_stack_slot): Likewise.
 (rs6000_preferred_reload_class): On VSX, we can create SFmode 0.0f
 via xxlxor, just like DFmode 0.0.


 * config/rs6000/dfp.md (movdd): Delete, combine with binary
 floating point moves in rs6000.md.  Combine power6x (mfpgpr) moves
 with other moves by using conditional constraits (wg).  Use LFIWZX
 and STFIWX for loading SDmode on power7.
 (movdd splitters): Likewise.
 (movdd_hardfloat32): Likewise.
 (movdd_softfloat32): Likewise.
 (movdd_hardfloat64_mfpgpr): Likewise.
 (movdd_hardfloat64): Likewise.
 (movdd_softfloat64): Likewise.

 * config/rs6000/rs6000.md (FMOVE64): New iterators to combine
 64-bit binary and decimal floating point moves.
 (FMOVE64X): Likewise.
 (movdf): Combine 64-bit binary and decimal floating point moves.
 Combine power6x (mfpgpr) moves with other moves by using
 conditional constraits (wg).
 (movmode for DFmode/DDmode): Likewise.
 (DFmode/DDmode splitters): Likewise.
 (movdf_hardfloat32): Likewise.
 (movmode_hardfloat32 for DFmode/DDmode): Likewise.
 (movdf_softfloat32): Likewise.
 (movdf_hardfloat64_mfpgpr): Likewise.
 (movdf_hardfloat64): Likewise.
 (movmode_hardfloat64 for DFmode/DDmode): Likewise.
 (movdf_softfloat64): Likewise.
 (movmode_softfloat64 for DFmode/DDmode): Likewise.
 (reload_mode_load): Move to later in the file so they aren't in
 the middle of the floating point move insns.
 (reload_mode_store): Likewise.

 * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wg
 constraint.

This patch is okay when 4.9 tree opens, in combination with the parts
you included in the TF/TD patch.

Again, please confirm that it still works on pre-POWER7 systems.

Thanks, David


Re: [PATCH] PowerPC merge TD/TF moves

2013-02-05 Thread David Edelsohn
On Wed, Jan 30, 2013 at 5:50 PM, Michael Meissner
meiss...@linux.vnet.ibm.com wrote:
 This patch like the previous 2 pages combines the decimal and binary floating
 point moves, this time for 128-bit floating point.

 In doing this patch, I discovered that I left out the code in the previous
 patch to enable the wg constraint to enable -mcpu=power6x to utilize the 
 direct
 move instructions.  So, I added the code in this patch, and also created a 
 test
 to make sure that direct moves are generated in the future.

 I also added the reload helper for DDmode to rs6000_vector_reload that was
 missed in the last patch.  This was harmless, since that is only used with an
 undocumented debug switch.  Hopefully sometime in the future, I will scalar
 floating point to be able to be loaded in the upper 32 VSX registers that are
 overlaid over the Altivec registers.

 Like the previous 2 patches, I've bootstrapped this, and ran make check with 
 no
 regressions.  Is it ok to apply when GCC 4.9 opens up?

 I have one more patch in the insn combination to post, combining movdi on
 systems with normal floating point and with the power6 direct move
 instructions.

 [gcc]
 2013-01-30  Michael Meissner  meiss...@linux.vnet.ibm.com

 * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print out wg
 constraint if -mdebug=reg.
 (rs6000_initi_hard_regno_mode_ok): Enable wg constraint if
 -mfpgpr.  Enable using dd reload support if needed.

 * config/rs6000/dfp.md (movtd): Delete, combine with 128-bit
 binary and decimal floating point moves in rs6000.md.
 (movtd_internal): Likewise.

 * config/rs6000/rs6000.md (FMOVE128): Combine 128-bit binary and
 decimal floating point moves.
 (movtf): Likewise.
 (movtf_internal): Likewise.
 (movmode_internal, TDmode/TFmode): Likewise.
 (movtf_softfloat): Likewise.
 (movmode_softfloat, TDmode/TFmode): Likewise.

 [gcc/testsuite]
 2013-01-30  Michael Meissner  meiss...@linux.vnet.ibm.com

 * gcc.target/powerpc/mmfpgpr.c: New test.

This patch is okay after 4.9 tree opens.  Again, please confirm that
it works on pre-POWER7 systems.

Thanks, David


Re: [PATCH] Enable SUPPORTS_INIT_PRIORITY on darwin

2013-02-05 Thread Jack Howarth
On Tue, Feb 05, 2013 at 09:30:48AM -0500, Jack Howarth wrote:
Once the requested patch to extend qsorting of init priorities to 
 destructors...
 
 http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00154.html
 
 is committed, the following patch enables SUPPORTS_INIT_PRIORITY on darwin. 
 The
 testsuite regression results are...
 
 http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg00520.html
 
 without and...
 
 http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg00522.html
 
 with SUPPORTS_INIT_PRIORITY enabled. Only the g++.dg/special/conpr-3.C 
 execution test
 fails as expected. The attached patch adds a dg-shouldfail on darwin for this 
 testcase
 as darwin lacks inter-module init priority support. With this patch, we will 
 have the
 same level of init priority support (ie only intra-modular) as clang. 
 Regression tested
 on x86_64-apple-darwin12. Okay for gcc trunk after the destructor qsorting 
 patch
 is committed?
 Jack

Mike,
I can confirm that we are able to work around lack of inter-module priority
support on darwin...

% g++-fsf-4.8 conpr-3.C conpr-3a.cc conpr-3b.cc
% ./a.out
Abort

by compiling with LTO...

% g++-fsf-4.8 -flto conpr-3.C conpr-3a.cc conpr-3b.cc
% ./a.out
%

Nice.
  Jack



 /gcc
 
 2013-02-05  Jack Howarth  howa...@bromo.med.uc.edu
 
   * gcc/config/darwin.h: Enable SUPPORTS_INIT_PRIORITY.
 
 /gcc/testsuite
 
 2013-02-05  Jack Howarth  howa...@bromo.med.uc.edu
 
   * g++.dg/special/conpr-3.C: Add dg-shouldfail on *-apple-darwin*.
 
 Index: gcc/testsuite/g++.dg/special/conpr-3.C
 ===
 --- gcc/testsuite/g++.dg/special/conpr-3.C(revision 195747)
 +++ gcc/testsuite/g++.dg/special/conpr-3.C(working copy)
 @@ -1,5 +1,6 @@
  /* { dg-do run { target init_priority } } */
  /* { dg-additional-sources conpr-3a.cc conpr-3b.cc } */
 +/* { dg-shouldfail No inter-module priority support { *-apple-darwin* } } 
 */
  
  #include stdlib.h
  
 Index: gcc/config/darwin.h
 ===
 --- gcc/config/darwin.h   (revision 195747)
 +++ gcc/config/darwin.h   (working copy)
 @@ -912,9 +912,8 @@ extern void darwin_driver_init (unsigned
darwin_driver_init (decoded_options_count, decoded_options)
  #endif
  
 -/* The Apple assembler and linker do not support constructor priorities.  */
 -#undef SUPPORTS_INIT_PRIORITY
 -#define SUPPORTS_INIT_PRIORITY 0
 +/* While the Apple assembler and linker do not support constructor 
 priorities,
 +   intra-module priority support is available through sort_cdtor_records. */
  
  /* When building cross-compilers (and native crosses) we shall default to 
 providing an osx-version-min of this unless overridden by the User.  */



Re: [PATCH], GCC 4.9 powerpc, merge movdi insns

2013-02-05 Thread David Edelsohn
On Wed, Jan 30, 2013 at 7:06 PM, Michael Meissner
meiss...@linux.vnet.ibm.com wrote:
 This is the last of the merge insn patches.  It merges the power6x movdi with
 the normal floating point movdi.

 2013-01-30  Michael Meissner  meiss...@linux.vnet.ibm.com

 * config/rs6000/rs6000.md (movdi_mfpgpr): Delete, combine with
 movdi_internal64, using wg constraint for move direct operations.

 Like the other patches, I have bootstrapped with it, and had no regression
 changes.  Once 4.9 opens up, is this acceptable to be checked in?

This patch is okay after 4.9 tree opens.

Thanks, David


Re: libgo patch committed: Update to current version of Go library

2013-02-05 Thread Ian Lance Taylor
On Thu, Jan 3, 2013 at 1:26 AM, Uros Bizjak ubiz...@gmail.com wrote:
 Hello!

 I've committed a patch to upgrade libgo to the current version of the
 master Go library.  As usual, this mail message only includes the
 changes to files that are specific to gccgo.  Bootstrapped and ran Go
 testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

 This caused massive testsuite problems on CentOS 5.8 due to missing
 utimensat.

This should be fixed now.  Please let me know if it is not.

Ian


Re: [PATCH] Add TF support for OpenBSD/i386 and OpenBSD/amd64

2013-02-05 Thread Mark Kettenis
 Date: Mon, 7 Jan 2013 12:49:14 -1000 (TAHT)
 From: Gerald Pfeifer ger...@pfeifer.com
 
 On Sun, 7 Oct 2012, Mark Kettenis wrote:
  Adds the necessary support bits to libgcc.  All other mainstream
  i386/amd64 targets already have this.
  
  Tested on i386-unknown-openbsd5.2 and x86_64-unknown-openbsd5.2.
  Fixes a couple of testcases.
  
  
  libgcc/:
  
  2012-10-06  Mark Kettenis  kette...@openbsd.org
  
  * config.host (i[34567]86-*-openbsd* and x86_64-*-openbsd*):
  Add to list of i[34567]86-*-* and x86_64-*-* soft-fp targets.
  
  gcc/:
  
  2012-10-06  Mark Kettenis  kette...@openbsd.org
  
  * config/i386/openbsdelf.h (LIBGCC2_HAS_TF_MODE, LIBGCC2_TF_CEXT) 
  (TF_SIZE): Define.
 
 I realized this somehow got stalled and since it only affects
 OpenBSD and you tested it there, I went ahead and did a build
 on x86_64-suse-linux to make sure there is not negative effect
 there and committed this.

Thanks!


libgo patch committed: Use DejaGNU when testing a cross-compiler

2013-02-05 Thread Ian Lance Taylor
This patch to libgo uses DejaGNU when testing a cross-compiler.  The
shell script is simpler but only works for a native configuration.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.  This should fix PR 56017.

Ian

diff -r 27e1a46c9cc2 libgo/Makefile.am
--- a/libgo/Makefile.am	Mon Feb 04 17:10:28 2013 -0800
+++ b/libgo/Makefile.am	Tue Feb 05 14:13:17 2013 -0800
@@ -1991,12 +1991,6 @@
 	files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \
 	$(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's/-go$$//'` -o $@ $$files
 
-if LIBGO_IS_RTEMS
-use_dejagnu = yes
-else
-use_dejagnu = no
-endif
-
 GOTESTFLAGS =
 
 # Check a package.
@@ -2015,7 +2009,7 @@
 	export LD_LIBRARY_PATH; \
 	$(MKDIR_P) $(@D); \
 	rm -f $@-testsum $@-testlog; \
-	if test $(use_dejagnu) = yes; then \
+	if test $(USE_DEJAGNU) = yes; then \
 	  $(SHELL) $(srcdir)/testsuite/gotest --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath=$(@D) --pkgfiles=$(go_$(subst /,_,$(@D))_files) --testname=$(@D) --goarch=$(GOARCH) $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \
 	else \
 	  if $(SHELL) $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath=$(@D) --pkgfiles=$(go_$(subst /,_,$(@D))_files) --goarch=$(GOARCH) $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files) $@-testlog 21; then \
diff -r 27e1a46c9cc2 libgo/configure.ac
--- a/libgo/configure.ac	Mon Feb 04 17:10:28 2013 -0800
+++ b/libgo/configure.ac	Tue Feb 05 14:13:17 2013 -0800
@@ -156,6 +156,17 @@
 AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes)
 AC_SUBST(GOOS)
 
+dnl Test whether we need to use DejaGNU or whether we can use the
+dnl simpler gotest approach.  We can only use gotest for a native
+dnl build.
+USE_DEJAGNU=no
+case ${host} in
+  *-*-rtems*) USE_DEJAGNU=yes ;;
+  ${target}) ;;
+  *) USE_DEJAGNU=yes ;;
+esac
+AC_SUBST(USE_DEJAGNU)
+
 dnl N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).
 is_386=no
 is_alpha=no


top level configure patch committed: Disable libgo on some systems

2013-02-05 Thread Ian Lance Taylor
This patch to the top level configure script avoids building libgo on
some systems where it is known to not work.  Bootstrapped on
x86_64-unknown-linux-gnu, where it does work.  Committed to mainline.
This is PR 55969.

Ian


2013-02-05  Ian Lance Taylor  i...@google.com

PR go/55969
* configure.ac: Disable libgo on some systems where it does not
work.


Index: configure.ac
===
--- configure.ac	(revision 195436)
+++ configure.ac	(working copy)
@@ -752,6 +752,23 @@ case ${target} in
 ;; 
 esac
 
+# Disable libgo for some systems where it is known to not work.
+# For testing, you can easily override this with --enable-libgo.
+if test x$enable_libgo = x; then
+case ${target} in
+*-*-darwin*)
+	# PR 46986
+	noconfigdirs=$noconfigdirs target-libgo
+	;;
+*-*-cygwin* | *-*-mingw*)
+	noconfigdirs=$noconfigdirs target-libgo
+	;;
+*-*-aix*)
+	noconfigdirs=$noconfigdirs target-libgo
+	;;
+esac
+fi
+
 # Default libgloss CPU subdirectory.
 libgloss_dir=$target_cpu
 


libgo patch committed: Fix argument passed to forcegchelper

2013-02-05 Thread Ian Lance Taylor
I got confused about the code where the heap scavenger starts
forcegchelper in libgo.  This patch corrects the argument passed in.
This should fix the segmentation violation reported in PR 56172.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu, where it
is less important because the code uses futexes rather than semaphores.
Committed to mainline.

Ian

diff -r 192e2bd0c012 libgo/runtime/mheap.c
--- a/libgo/runtime/mheap.c	Tue Feb 05 14:21:50 2013 -0800
+++ b/libgo/runtime/mheap.c	Tue Feb 05 15:56:49 2013 -0800
@@ -405,7 +405,7 @@
 			// GC blocks other goroutines via the runtime_worldsema.
 			runtime_noteclear(note);
 			notep = note;
-			__go_go(forcegchelper, (void*)notep);
+			__go_go(forcegchelper, (void*)notep);
 			runtime_entersyscall();
 			runtime_notesleep(note);
 			runtime_exitsyscall();


C++ PATCH for c++/56208 (wrong sfinae with private inheritance)

2013-02-05 Thread Jason Merrill
In this case, when we see the explicit template arguments for test and 
go to substitute them into the type of sfinae_base::test, we were 
recording that we wanted to check access to sfinae_base::make in the 
context of is_printable, but then by the time we got around to checking 
it we had pushed into the context of sfinae_base which doesn't have the 
right to see make by way of is_printable.  Fixed by discarding any 
deferred access checks from explicit template argument substitution, 
because we'll get the same access checks when we substitute in all the 
template arguments in instantiate_template, and those will have the 
right access path.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit a194a47d7bc3bbdc362ba78cbb30fc493b9a3fdb
Author: Jason Merrill ja...@redhat.com
Date:   Tue Feb 5 14:01:41 2013 -0500

	PR c++/56208
	* pt.c (fn_type_unification): Discard any access checks from
	substituting explicit args.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7430289..aa127ed 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14989,6 +14989,12 @@ fn_type_unification (tree fn,
   if (fntype == error_mark_node)
 	goto fail;
 
+  /* Throw away these access checks; we'll see them again in
+	 instantiate_template and they might have the wrong
+	 access path at this point.  */
+  pop_deferring_access_checks ();
+  push_deferring_access_checks (dk_deferred);
+
   /* Place the explicitly specified arguments in TARGS.  */
   for (i = NUM_TMPL_ARGS (explicit_targs); i--;)
 	TREE_VEC_ELT (targs, i) = TREE_VEC_ELT (explicit_targs, i);
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae43.C b/gcc/testsuite/g++.dg/cpp0x/sfinae43.C
new file mode 100644
index 000..22efe65
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae43.C
@@ -0,0 +1,31 @@
+// PR c++/56208
+// { dg-options -std=c++11 }
+
+struct ostream {
+  ostream operator(int);
+};
+
+struct sfinae_base {
+
+  typedef char one;
+  typedef char (two)[2];
+
+  templateclass T
+  static T make();
+
+  templateunsigned struct ok { typedef int type; };
+
+  templateclass U, class T
+  static one test(decltype((makeU()  makeT()), 0));
+
+  templateclass, class
+  static two test(...);
+};
+
+templateclass T
+struct is_printable : private sfinae_base
+{
+  enum { value = sizeof(testostream, T(0)) == sizeof(one) };
+};
+
+typedef int ok[is_printableint::value ? 1 : -1];


C++ PATCH for c++/56177 ( ICE with return type deduction)

2013-02-05 Thread Jason Merrill
When we start processing a function and find that it was declared 
previously, we use the old declaration.  In that case we should use the 
old version of the return type, as well.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 3589139ea249533cc5ebb5ef9c38d72fc159f6fd
Author: Jason Merrill ja...@redhat.com
Date:   Tue Feb 5 14:40:56 2013 -0500

	PR c++/56177
	* decl.c (start_preparsed_function): Update restype if we change
	decl1.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9b40018..cfee0f8 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13116,6 +13116,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
 	DECL_CONTEXT (decl1) = DECL_CONTEXT (DECL_TI_TEMPLATE (decl1));
 	}
   fntype = TREE_TYPE (decl1);
+  restype = TREE_TYPE (fntype);
 
   /* If #pragma weak applies, mark the decl appropriately now.
 	 The pragma only applies to global functions.  Because
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn14.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn14.C
new file mode 100644
index 000..e7e8699
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn14.C
@@ -0,0 +1,5 @@
+// PR c++/56177
+// { dg-options -std=c++1y }
+
+auto f ();
+auto f () { return 33; }


Re: var-tracking wrt. leaf regs on sparc

2013-02-05 Thread David Miller
From: David Miller da...@davemloft.net
Date: Tue, 05 Feb 2013 18:18:39 -0500 (EST)

 The only other alternative I can see would be to get everything in
 var-tracking.c and the other subsystems it uses to do leaf register
 remapping, but that seems completely like the wrong way to handle
 this.

Following up to myself... :-)

Now that I understand fully what we're trying to accomplish with the
DT_OP_GNU_entry_value and DT_OP_GNU_call_site_parameter extensions, it
does in fact seem like we will need to do leaf register remapping in
var-tracking.c

Here below is a patch I'm playing with.  It's a rough draft but it
definitely fixes the pr54200.c problem completely.

Another way to do this would be to not translate the incoming
parameter registers (leave them at %i*) if we don't see the window
save.  That way we only have to play the regno remapping game for
these specific incoming argument pieces, rather than for everything we
look at in the RTL stream.

diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 714acb69..14635b9 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -1057,6 +1057,32 @@ adjust_mem_stores (rtx loc, const_rtx expr, void *data)
 }
 }
 
+/* Given a regno from the RTL instruction stream, return the
+   actual register number that will be used by final and debug
+   info emission.  */
+static unsigned int
+real_regno (unsigned int regno)
+{
+#ifdef LEAF_REG_REMAP
+  if (regno  FIRST_PSEUDO_REGISTER
+   crtl-uses_only_leaf_regs)
+{
+  int remapped = LEAF_REG_REMAP (regno);
+
+  if (remapped = 0)
+   regno = (unsigned int) remapped;
+}
+#endif
+
+  return regno;
+}
+
+static unsigned int
+real_regno_rtx (rtx reg)
+{
+  return real_regno (REGNO (reg));
+}
+
 /* Simplify INSN.  Remove all {PRE,POST}_{INC,DEC,MODIFY} rtxes,
replace them with their value in the insn and add the side-effects
as other sets to the insn.  */
@@ -1804,12 +1830,12 @@ var_reg_decl_set (dataflow_set *set, rtx loc, enum 
var_init_status initialized,
   if (decl_p)
 dv = dv_from_decl (var_debug_decl (dv_as_decl (dv)));
 
-  for (node = set-regs[REGNO (loc)]; node; node = node-next)
+  for (node = set-regs[real_regno_rtx (loc)]; node; node = node-next)
 if (dv_as_opaque (node-dv) == dv_as_opaque (dv)
 node-offset == offset)
   break;
   if (!node)
-attrs_list_insert (set-regs[REGNO (loc)], dv, offset, loc);
+attrs_list_insert (set-regs[real_regno_rtx (loc)], dv, offset, loc);
   set_variable_part (set, loc, dv, offset, initialized, set_src, iopt);
 }
 
@@ -1875,7 +1901,7 @@ var_reg_delete_and_set (dataflow_set *set, rtx loc, bool 
modify,
   if (initialized == VAR_INIT_STATUS_UNKNOWN)
 initialized = get_init_value (set, loc, dv_from_decl (decl));
 
-  nextp = set-regs[REGNO (loc)];
+  nextp = set-regs[real_regno_rtx (loc)];
   for (node = *nextp; node; node = next)
 {
   next = node-next;
@@ -1904,7 +1930,7 @@ var_reg_delete_and_set (dataflow_set *set, rtx loc, bool 
modify,
 static void
 var_reg_delete (dataflow_set *set, rtx loc, bool clobber)
 {
-  attrs *nextp = set-regs[REGNO (loc)];
+  attrs *nextp = set-regs[real_regno_rtx (loc)];
   attrs node, next;
 
   if (clobber)
@@ -2386,7 +2412,7 @@ val_bind (dataflow_set *set, rtx val, rtx loc, bool 
modified)
   if (REG_P (loc))
 {
   if (modified)
-   var_regno_delete (set, REGNO (loc));
+   var_regno_delete (set, real_regno_rtx (loc));
   var_reg_decl_set (set, loc, VAR_INIT_STATUS_INITIALIZED,
dv_from_value (val), 0, NULL_RTX, INSERT);
 }
@@ -2584,7 +2610,7 @@ val_resolve (dataflow_set *set, rtx val, rtx loc, rtx 
insn)
 {
   attrs node, found = NULL;
 
-  for (node = set-regs[REGNO (loc)]; node; node = node-next)
+  for (node = set-regs[real_regno_rtx (loc)]; node; node = node-next)
if (dv_is_value_p (node-dv)
 GET_MODE (dv_as_value (node-dv)) == GET_MODE (loc))
  {
@@ -2838,7 +2864,8 @@ variable_union (variable src, dataflow_set *set)
{
  if (!((REG_P (node2-loc)
  REG_P (node-loc)
- REGNO (node2-loc) == REGNO (node-loc))
+ (real_regno_rtx (node2-loc)
+== real_regno_rtx (node-loc)))
|| rtx_equal_p (node2-loc, node-loc)))
{
  if (node2-init  node-init)
@@ -2871,7 +2898,8 @@ variable_union (variable src, dataflow_set *set)
  for (node = src-var_part[i].loc_chain; node; node = node-next)
if (!((REG_P (dstnode-loc)
REG_P (node-loc)
-   REGNO (dstnode-loc) == REGNO (node-loc))
+   (real_regno_rtx (dstnode-loc)
+  == real_regno_rtx (node-loc)))
  || rtx_equal_p (dstnode-loc, node-loc)))
  {
location_chain new_node;
@@ -2920,7 +2948,8 

C++ PATCH for c++/54122 (ICE with 'this' capture)

2013-02-05 Thread Jason Merrill
We were crashing in lvalue_kind because we were trying to test whether a 
NULL type was a METHOD_TYPE.  The reason we would care whether the type 
is a METHOD_TYPE is lost to history; the change was there in the first 
version of that function that appeared in 1995.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 19ec4361510b137bc60631193cd47e378fc1b314
Author: Jason Merrill ja...@redhat.com
Date:   Tue Feb 5 23:04:01 2013 -0500

	PR c++/54122
	* tree.c (lvalue_kind) [INDIRECT_REF]: Don't check for
	METHOD_TYPE.

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index d1f14fc..18d9a98 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -143,9 +143,7 @@ lvalue_kind (const_tree ref)
 case ARRAY_REF:
 case PARM_DECL:
 case RESULT_DECL:
-  if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
-	return clk_ordinary;
-  break;
+  return clk_ordinary;
 
   /* A scope ref in a template, left as SCOPE_REF to support later
 	 access checking.  */
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this7.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this7.C
new file mode 100644
index 000..6e25c33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this7.C
@@ -0,0 +1,11 @@
+// PR c++/54122
+// { dg-options -std=c++11 }
+
+enum E { F };
+
+template typename A
+struct C
+{
+  E e;
+  void f () { auto l = [](void)-void { if (e == F) return; }; }
+};