[PATCH] Fix parallel build

2012-03-01 Thread Khem Raj
When building in parallel (with -j8 here)
install-gcc-ar sometimes wants to install file
before the destination directory is created.

2012-02-29  Khem Raj  raj.k...@gmail.com

* Makefile.in (install-gcc-ar): Add dependency on installdirs.
---
 gcc/Makefile.in |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f6cf8ff..91c5794 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4811,7 +4811,7 @@ install-collect2: collect2 installdirs
 install-lto-wrapper: lto-wrapper$(exeext)
$(INSTALL_PROGRAM) lto-wrapper$(exeext) 
$(DESTDIR)$(libexecsubdir)/lto-wrapper$(exeext)
 
-install-gcc-ar:
+install-gcc-ar: installdirs
set -e ; \
for i in ar nm ranlib ; do \
  install_name=`echo gcc-$$i|sed '$(program_transform_name)'`$(exeext) 
;\
-- 
1.7.9



Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Kai Tietz
2012/2/27 Joseph S. Myers jos...@codesourcery.com:
 On Mon, 27 Feb 2012, Kai Tietz wrote:

 2012-02-28  Kai Tietz  kti...@redhat.com

       * soft-fp/soft-fp.h (_FP_STRUCT_LAYOUT): If not defined,
       define it as empty macro.
       * soft-fp/quad.h: Mark bitfield-structures by _FP_STRUCT_LAYOUT.
       * soft-fp/extended.h: Likewise.
       * soft-fp/single.h: Likewise.
       * soft-fp/double.h: Likewise.

 Thanks.  This looks fine to me, modulo ChangeLog and comment wording and
 copyright year updates.  I'd propose to commit it in a few days' time with
 those fixed unless anyone sees any problems with it.

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

Thanks, I adjusted ChangeLog, comment, and added the copyright year.
It would be kind, if somebody could apply this patch to glibc's
repository as I don't have commit access to it.  I can do the applying
to gcc's tree, if patch is ok-ed.

ChangeLog glibc

2012-03-01  Kai Tietz  kti...@redhat.com

* soft-fp/soft-fp.h (_FP_STRUCT_LAYOUT): New macro.
Adjusted copyright year.
* soft-fp/quad.h (_FP_UNION_Q): Mark bitfield-struct
part by _FP_STRUCT_LAYOUT.
Adjusted copyright year.
* soft-fp/extended.h: Likewise.
* soft-fp/single.h (_FP_UNION_S): Likewise.
* soft-fp/double.h (_FP_UNION_D): Likewise.

Thanks in advance,
Kai

Index: soft-fp/extended.h
===
--- soft-fp/extended.h  (revision 184686)
+++ soft-fp/extended.h  (working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Extended Precision.
-   Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1999,2006,2007, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek (j...@ultra.linux.cz).

@@ -64,7 +64,7 @@
 union _FP_UNION_E
 {
XFtype flt;
-   struct
+   struct _FP_STRUCT_LAYOUT
{
 #if __BYTE_ORDER == __BIG_ENDIAN
   unsigned long pad1 : _FP_W_TYPE_SIZE;
@@ -263,7 +263,7 @@
 union _FP_UNION_E
 {
   XFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 _FP_W_TYPE pad  : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
 unsigned sign   : 1;
Index: soft-fp/single.h
===
--- soft-fp/single.h(revision 184686)
+++ soft-fp/single.h(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Single Precision.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
  Jakub Jelinek (j...@ultra.linux.cz),
@@ -58,7 +58,7 @@
 union _FP_UNION_S
 {
   SFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign : 1;
 unsigned exp  : _FP_EXPBITS_S;
Index: soft-fp/double.h
===
--- soft-fp/double.h(revision 184686)
+++ soft-fp/double.h(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Double Precision
-   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009
+   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009, 2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
@@ -68,7 +68,7 @@
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign  : 1;
 unsigned exp   : _FP_EXPBITS_D;
@@ -167,7 +167,7 @@
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign   : 1;
 unsigned exp: _FP_EXPBITS_D;
Index: soft-fp/quad.h
===
--- soft-fp/quad.h  (revision 184686)
+++ soft-fp/quad.h  (working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Quad Precision.
-   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
  Jakub Jelinek (j...@ultra.linux.cz),
@@ -67,7 +67,7 @@
 union _FP_UNION_Q
 {
TFtype flt;
-   struct
+   struct _FP_STRUCT_LAYOUT
{
 #if __BYTE_ORDER == __BIG_ENDIAN
   unsigned sign : 1;
@@ -171,10 +171,11 @@
 union _FP_UNION_Q
 {
   TFtype flt /* __attribute__((mode(TF))) */ ;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 _FP_W_TYPE a, b;
   } longs;
-  struct {
+  struct _FP_STRUCT_LAYOUT
+  {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign: 1;
 unsigned exp : 

Re: [Patch 1] invoke.texi : Document AMD bdver2

2012-03-01 Thread Richard Guenther
On Thu, 1 Mar 2012, Kumar, Venkataramanan wrote:

 Hi Maintainers,
 
 We want to add bdver2 description in invoke.texi for GCC 4.7. Here is the 
 patch that does that.
 
 Index: gcc/doc/invoke.texi
 ===
 --- gcc/doc/invoke.texi (revision 183891)
 +++ gcc/doc/invoke.texi (working copy)
 @@ -13063,8 +13063,12 @@
  @item bdver1
  AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
  supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, 
 SSE4A,
 -SSSE3, SSE4.1, SSE4.2, 3DNow!, enhanced 3DNow!, ABM and 64-bit
 -instruction set extensions.)
 +SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
 +@item bdver2
 +AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
 +supersets BMI, TBM, F16C, FMA, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE,
 +SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
 +extensions.)
  @item btver1
  AMD Family 14h core based CPUs with x86-64 instruction set support.  (This
  supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
 
 Index: gcc/ChangeLog
 ===
 --- gcc/ChangeLog   (revision 183891)
 +++ gcc/ChangeLog   (working copy)
 @@ -1,3 +1,6 @@
 +2012-03-01  Venkataramanan Kumar  venkataramanan.ku...@amd.com
 +   * doc/invoke.texi: Document AMD bdver2 and remove mentioning 3DNow 
 from bdver1.
 +
  2012-02-03  Jakub Jelinek  ja...@redhat.com
 Zdenek Dvorak  o...@ucw.cz
 
 Ok for trunk ? 

Ok, but please watch formatting of the ChangeLog entry, you miss a newline
before * doc/invoke.texi

Thanks,
Richard.

 Can I commit in trunk so that it gets picked up for GCC 4.7?
 
 Regards,
 Venkat.
 
 

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

Re: [PATCH] Fix PR52406

2012-03-01 Thread Richard Guenther
On Wed, 29 Feb 2012, Richard Guenther wrote:

 On Wed, 29 Feb 2012, Michael Matz wrote:
 
  Hi,
  
  On Wed, 29 Feb 2012, Richard Guenther wrote:
  
   the whole base object - instead I mark the base MEM_REF of such accesses 
   with TREE_NO_WARNING (ugh) and special-case for them in dr_may_alias_p.  
  
  At least use a flag that isn't currently used for MEM_REF.  E.g. 
  addressable_flag, and make a new macro that checks for the tree being a 
  MEMREF to access it.
 
 Ok, I'll use TREE_VISITED.  The alternative is to increase the size of
 struct indices (and thus all data-refs) and have a separate flag.

As follows (also removes an unused entry in all data-refs and updates
the docs).

Bootstrapped and tested on x86_64-unknown-linux-gnu, queued for stage1 / 
4.7.1.

Richard.

2012-02-29  Richard Guenther  rguent...@suse.de

PR tree-optimization/52406
* tree-data-ref.h: Update documentation about DR_BASE_OBJECT.
(struct dr_alias): Remove unused vops member.
* tree-data-ref.c (dr_analyze_indices): For COMPONENT_REFs
add indices to allow their disambiguation.  Make DR_BASE_OBJECT
be an artificial access that covers the whole indexed object,
or mark it with TREE_VISITED if we cannot do so.  Canonicalize
plain decl base-objects to their MEM_REF variant.
(dr_may_alias_p): When the base-object of either data reference
has unknown size use only points-to information.
(compute_affine_dependence): Make dumps easier to read and
more verbose.
* tree-vect-data-ref.c (vector_alignment_reachable_p): Use
DR_REF when looking for packed references.
(vect_supportable_dr_alignment): Likewise.

* gcc.dg/torture/pr52406.c: New testcase.

Index: gcc/tree-data-ref.h
===
*** gcc/tree-data-ref.h (revision 184656)
--- gcc/tree-data-ref.h (working copy)
*** struct innermost_loop_behavior
*** 60,75 
  };
  
  /* Describes the evolutions of indices of the memory reference.  The indices
!are indices of the ARRAY_REFs and the operands of INDIRECT_REFs.
!For ARRAY_REFs, BASE_OBJECT is the reference with zeroed indices
!(note that this reference does not have to be valid, if zero does not
!belong to the range of the array; hence it is not recommended to use
!BASE_OBJECT in any code generation).  For INDIRECT_REFs, the address is
!set to the loop-invariant part of the address of the object, except for
!the constant offset.  For the examples above,
  
!base_object:a[0].b[0][0]   *(p + x + 4B * j_0)
 indices:{j_0, +, 1}_2  {16, +, 4}_2
   {i_0, +, 1}_1
   {j_0, +, 1}_2
  */
--- 60,76 
  };
  
  /* Describes the evolutions of indices of the memory reference.  The indices
!are indices of the ARRAY_REFs, indexes in artificial dimensions
!added for member selection of records and the operands of MEM_REFs.
!BASE_OBJECT is the part of the reference that is loop-invariant
!(note that this reference does not have to cover the whole object
!being accessed, in which case TREE_VISITED is set on it; hence it is
!not recommended to use BASE_OBJECT in any code generation).
!For the examples above,
  
!base_object:a  *(p + x + 4B * j_0)
 indices:{j_0, +, 1}_2  {16, +, 4}_2
+  4
   {i_0, +, 1}_1
   {j_0, +, 1}_2
  */
*** struct indices
*** 86,98 
  struct dr_alias
  {
/* The alias information that should be used for new pointers to this
!  location.  SYMBOL_TAG is either a DECL or a SYMBOL_MEMORY_TAG.  */
struct ptr_info_def *ptr_info;
- 
-   /* The set of virtual operands corresponding to this memory reference,
-  serving as a description of the alias information for the memory
-  reference.  This could be eliminated if we had alias oracle.  */
-   bitmap vops;
  };
  
  /* An integer vector.  A vector formally consists of an element of a vector
--- 87,94 
  struct dr_alias
  {
/* The alias information that should be used for new pointers to this
!  location.  */
struct ptr_info_def *ptr_info;
  };
  
  /* An integer vector.  A vector formally consists of an element of a vector
Index: gcc/tree-data-ref.c
===
*** gcc/tree-data-ref.c (revision 184656)
--- gcc/tree-data-ref.c (working copy)
*** static void
*** 856,862 
  dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
  {
VEC (tree, heap) *access_fns = NULL;
!   tree ref, *aref, op;
tree base, off, access_fn;
basic_block before_loop;
  
--- 856,862 
  dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
  {
VEC (tree, heap) 

[Committed] RE: [Patch 1] invoke.texi : Document AMD bdver2

2012-03-01 Thread Kumar, Venkataramanan
Thanks Richard.

I have committed the patch and taken care of new line as well.

Regards,
Venkat.

 -Original Message-
 From: Richard Guenther [mailto:rguent...@suse.de]
 Sent: Thursday, March 01, 2012 2:55 PM
 To: Kumar, Venkataramanan
 Cc: gcc-patches@gcc.gnu.org; ger...@pfeifer.com; ubiz...@gmail.com; Neill,
 Quentin
 Subject: Re: [Patch 1] invoke.texi : Document AMD bdver2
 
 On Thu, 1 Mar 2012, Kumar, Venkataramanan wrote:
 
  Hi Maintainers,
 
  We want to add bdver2 description in invoke.texi for GCC 4.7. Here is the
 patch that does that.
 
  Index: gcc/doc/invoke.texi
  ===
  --- gcc/doc/invoke.texi (revision 183891)
  +++ gcc/doc/invoke.texi (working copy)
  @@ -13063,8 +13063,12 @@
   @item bdver1
   AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
   supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3,
 SSE4A,
  -SSSE3, SSE4.1, SSE4.2, 3DNow!, enhanced 3DNow!, ABM and 64-bit
  -instruction set extensions.)
  +SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
  +@item bdver2
  +AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
  +supersets BMI, TBM, F16C, FMA, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE,
  +SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
  +extensions.)
   @item btver1
   AMD Family 14h core based CPUs with x86-64 instruction set support.  (This
   supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
 
  Index: gcc/ChangeLog
  ===
  --- gcc/ChangeLog   (revision 183891)
  +++ gcc/ChangeLog   (working copy)
  @@ -1,3 +1,6 @@
  +2012-03-01  Venkataramanan Kumar  venkataramanan.ku...@amd.com
  +   * doc/invoke.texi: Document AMD bdver2 and remove mentioning 3DNow
 from bdver1.
  +
   2012-02-03  Jakub Jelinek  ja...@redhat.com
  Zdenek Dvorak  o...@ucw.cz
 
  Ok for trunk ?
 
 Ok, but please watch formatting of the ChangeLog entry, you miss a newline
 before * doc/invoke.texi
 
 Thanks,
 Richard.
 
  Can I commit in trunk so that it gets picked up for GCC 4.7?
 
  Regards,
  Venkat.
 
 
 
 --
 Richard Guenther rguent...@suse.de
 SUSE / SUSE Labs
 SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer



Re: Two files still GPLv2

2012-03-01 Thread Richard Guenther
On Wed, Feb 29, 2012 at 7:36 PM, Steven Bosscher stevenb@gmail.com wrote:
 Hello,

 This fixes two files that still have the GPLv2 copyright notice.
 OK for trunk?

Ok.

Thanks,
Richard.

 Ciao!
 Steven


Re: [PATCH, PR50335] Disable graphite loop flattening

2012-03-01 Thread Richard Guenther
On Thu, Mar 1, 2012 at 6:28 AM, Maxim Kuvyrkov ma...@codesourcery.com wrote:
 This patch disables graphite loop flattening optimization due to it being 
 effectively unmaintained.  To avoid users trying to use unsupported 
 optimization and reporting bugs, Sebastian Pop suggested to disable the 
 optimization.

 Testing on x86_64 is underway.  OK to apply provided no regressions?

That cannot be enough, you need to adjust the testsuite as well.  And
if it is broken,
why not remove it.  Leaving unmaintained broken code in the repository is just
a maintainance burden for no gain.

So, please provide a complete removal patch (docs, making the option a
dummy one, testcases, etc.)

Richard.

 --
 Maxim Kuvyrkov
 CodeSourcery / Mentor Graphics



Re: [PATCH] Fix parallel build

2012-03-01 Thread Richard Guenther
On Thu, Mar 1, 2012 at 9:11 AM, Khem Raj raj.k...@gmail.com wrote:
 When building in parallel (with -j8 here)
 install-gcc-ar sometimes wants to install file
 before the destination directory is created.

Ok.

Thanks,
Richard.

 2012-02-29  Khem Raj  raj.k...@gmail.com

        * Makefile.in (install-gcc-ar): Add dependency on installdirs.
 ---
  gcc/Makefile.in |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/gcc/Makefile.in b/gcc/Makefile.in
 index f6cf8ff..91c5794 100644
 --- a/gcc/Makefile.in
 +++ b/gcc/Makefile.in
 @@ -4811,7 +4811,7 @@ install-collect2: collect2 installdirs
  install-lto-wrapper: lto-wrapper$(exeext)
        $(INSTALL_PROGRAM) lto-wrapper$(exeext) 
 $(DESTDIR)$(libexecsubdir)/lto-wrapper$(exeext)

 -install-gcc-ar:
 +install-gcc-ar: installdirs
        set -e ; \
        for i in ar nm ranlib ; do \
          install_name=`echo gcc-$$i|sed '$(program_transform_name)'`$(exeext) 
 ;\
 --
 1.7.9



[PATCH] GIMPLE verification of pointer-int conversions (PR52443)

2012-03-01 Thread Richard Guenther

This should fix PR52443 - it is not necessary to restrict integer to
pointer conversions.  We do restrict pointer to integer conversions
because of the unknown signedness of pointers.  There is no reason
to do the same for integer to pointer conversions.

Bootstrap and regtest on x86_64-unknown-linux-gnu running, but there
is only strictly more cases that now return OK GIMPLE - so I consider
this for trunk at this stage.

Richard.

2012-03-01  Richard Guenther  rguent...@suse.de

PR middle-end/52443
* tree-cfg.c (verify_gimple_assign_unary): Allow any
conversions from integral types to pointer types.

Index: gcc/tree-cfg.c
===
--- gcc/tree-cfg.c  (revision 184688)
+++ gcc/tree-cfg.c  (working copy)
@@ -3340,15 +3429,12 @@ verify_gimple_assign_unary (gimple stmt)
 {
 CASE_CONVERT:
   {
-   /* Allow conversions between integral types and pointers only if
+   /* Allow conversions pointer type to integral type only if
   there is no sign or zero extension involved.
   For targets were the precision of ptrofftype doesn't match that
-  of pointers we need to allow arbitrary conversions from and
-  to ptrofftype.  */
+  of pointers we need to allow arbitrary conversions to ptrofftype.  */
if ((POINTER_TYPE_P (lhs_type)
- INTEGRAL_TYPE_P (rhs1_type)
- (TYPE_PRECISION (lhs_type) = TYPE_PRECISION (rhs1_type)
-|| ptrofftype_p (rhs1_type)))
+ INTEGRAL_TYPE_P (rhs1_type))
|| (POINTER_TYPE_P (rhs1_type)
 INTEGRAL_TYPE_P (lhs_type)
 (TYPE_PRECISION (rhs1_type) = TYPE_PRECISION (lhs_type)



Re: [Patch wwwdocs] gcc-4.6/changes.html : Document AMD bdver1

2012-03-01 Thread Gerald Pfeifer
On Thu, 1 Mar 2012, Kumar, Venkataramanan wrote:
 This patch was approved in November 2011, but got missed out for commit 
 so reposting it.

 
 Index: changes.html
 ===
 RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/changes.html,v
 retrieving revision 1.137
 diff -r1.137 changes.html
 819a820,822
 liSupport for AMD Bulldozer (family 15) processors is now available
   through the code-march=bdver1/code and code-mtune=bdver1/code
   options./li

Approval still holds, please go ahead.

Gerald


[patch testsuite]: Adjust some tests for mingw targets

2012-03-01 Thread Kai Tietz
Hi,

this test adjust some test for mingw targets.

ChangeLog

2012-03-01  Kai Tietz  kti...@redhat.com

* gcc.dg/torture/pr47917.c: Make test using POSIX-printf
routines on mingw targets.
* gcc.dg/vect/pr46126.c (size_t): Add support for
LLP64 target.
* gcc.dg/format/dfp-scanf-1.c: Adjust dg-skip-if rule
for mingw targets.

Ok for apply?

Regards,
Kai

Index: gcc.dg/torture/pr47917.c
===
--- gcc.dg/torture/pr47917.c(revision 184657)
+++ gcc.dg/torture/pr47917.c(working copy)
@@ -3,6 +3,7 @@
 /* { dg-options -std=c99 -D_ISO_C_SOURCE=19990L { target
alpha*-dec-osf5* } } */
 /* { dg-options -std=c99 -D_XOPEN_SOURCE=500 { target
mips-sgi-irix6.5 *-*-solaris2.[89] } } */
 /* { dg-options -std=gnu99 { target *-*-hpux* } } */
+/* { dg-additional-options -D__USE_MINGW_ANSI_STDIO=1 { target
*-*-mingw* } } */
 /* { dg-xfail-if no C99 snprintf function { *-*-hpux10* } } */
 /* { dg-xfail-run-if non-conforming C99 snprintf { *-*-hpux11.[012]* } } */

Index: gcc.dg/vect/pr46126.c
===
--- gcc.dg/vect/pr46126.c   (revision 184657)
+++ gcc.dg/vect/pr46126.c   (working copy)
@@ -1,5 +1,7 @@
 /* { dg-do compile } */

+__extension__ typedef __SIZE_TYPE__ size_t;
+
 typedef struct TypHeader {
  struct TypHeader * * ptr;
  unsigned char type;
@@ -11,13 +13,13 @@
  TypHandle * ptApp;
  long lp;
  long lc;
- hdApp = ((long)(((TypHandle*)((hdCall)-ptr))[1])1 ?
+ hdApp = ((size_t)(((TypHandle*)((hdCall)-ptr))[1])1 ?
 (((TypHandle*)((hdCall)-ptr))[1]) : (*
-EvTab[(((long)(((TypHandle*)((hdCall)-ptr))[1])  1) ? 1 :
+EvTab[(((size_t)(((TypHandle*)((hdCall)-ptr))[1])  1) ? 1 :
 
TypHandle*)((hdCall)-ptr))[1])-type))])TypHandle*)((hdCall)-ptr))[1])));
  ptApp = ((TypHandle*)((hdApp)-ptr));
- ptApp[1] = ((TypHandle) (((long)(lp)  2) + 1));
- ptApp[2] = ((TypHandle) (((long)(lc)  2) + 1));
+ ptApp[1] = ((TypHandle) (size_t) (((long)(lp)  2) + 1));
+ ptApp[2] = ((TypHandle) (size_t) (((long)(lc)  2) + 1));
  }

 /* { dg-final { cleanup-tree-dump vect } } */
Index: gcc.dg/format/dfp-scanf-1.c
===
--- gcc.dg/format/dfp-scanf-1.c (revision 184657)
+++ gcc.dg/format/dfp-scanf-1.c (working copy)
@@ -3,7 +3,7 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target dfp } */
 /* { dg-options -Wformat } */
-/* { dg-skip-if No scanf/printf dfp support { *-*-mingw* } } */
+/* { dg-skip-if No scanf/printf dfp support { *-*-mingw* } { * }
{  } } */

 #include format.h


[PATCH, 4.4, PR 52430] IPA-CP has to clone or leave alone externally_visible nodes

2012-03-01 Thread Martin Jambor
Hi,

the following patch backports 4.5 behavior to 4.4 IPA-CP
initialization when it decides which nodes need to be duplicated (we
often say cloned, but cloning is an overloaded term in gcc) in order
to modify them.  In 4.5, this is decided by a new predicate called
cgraph_only_called_directly_p which checks both node-needed and
node-local.externally_visible, whereas 4.4 looks only at the needed
flag.

As described in the PR, this wrecks havoc for ipcp_update_callgraph
which is the stage of the old IPA-CP when it undoes its decisions
which turned out not to be safe.

Bootstrapped and tested on x86_64-linux, OK for the branch?

Thanks,

Martin


2012-02-29  Martin Jambor  mjam...@suse.cz

PR tree-optimization/52430
* ipa-cp.c (ipcp_initialize_node_lattices): Also consider
node-local.externally_visible as needed.

Index: gcc/ipa-cp.c
===
--- gcc/ipa-cp.c(revision 184662)
+++ gcc/ipa-cp.c(working copy)
@@ -508,7 +508,7 @@ ipcp_initialize_node_lattices (struct cg
 
   if (ipa_is_called_with_var_arguments (info))
 type = IPA_BOTTOM;
-  else if (!node-needed)
+  else if (!node-needed  !node-local.externally_visible)
 type = IPA_TOP;
   /* When cloning is allowed, we can assume that externally visible functions
  are not called.  We will compensate this by cloning later.  */



Re: [PATCH][ARM] NEON DImode not

2012-03-01 Thread Andrew Stubbs

On Wed 29 Feb 2012 18:00:19 GMT, Richard Earnshaw wrote:

Why can't we have a single insn that deals with the have-neon and
dont-have-neon cases?


Sorry, I'm not sure I follow?

There's one insn for the have-neon case, and one for the 
don't-have-neon. The expander is necessary to prevent gen_one_cmpldi2 
locking recog to a disabled pattern (it caches the recog result, I think).


It would be possible to have the arm.md insn emit NEON instructions, but 
that's not the usual practice, I think? The neon.md isns could also emit 
arm/thumb2 instructions, but there's no real point since there are 
already two different splitters for that.


Andrew


Re: [patch testsuite]: Adjust some tests for mingw targets

2012-03-01 Thread Rainer Orth
Kai Tietz ktiet...@googlemail.com writes:

 this test adjust some test for mingw targets.

would you please fix you mailer not to break long lines?  It makes
reviewing harder.

 Index: gcc.dg/vect/pr46126.c
 ===
 --- gcc.dg/vect/pr46126.c (revision 184657)
 +++ gcc.dg/vect/pr46126.c (working copy)
 @@ -1,5 +1,7 @@
  /* { dg-do compile } */

 +__extension__ typedef __SIZE_TYPE__ size_t;

I think you should use __UINTPTR_TYPE__/uintptr_t instead.

 Index: gcc.dg/format/dfp-scanf-1.c
 ===
 --- gcc.dg/format/dfp-scanf-1.c   (revision 184657)
 +++ gcc.dg/format/dfp-scanf-1.c   (working copy)
 @@ -3,7 +3,7 @@
  /* { dg-do compile } */
  /* { dg-require-effective-target dfp } */
  /* { dg-options -Wformat } */
 -/* { dg-skip-if No scanf/printf dfp support { *-*-mingw* } } */
 +/* { dg-skip-if No scanf/printf dfp support { *-*-mingw* } { * }
 {  } } */


What's the point of this change?  Why are you explicitly adding the
defaults?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[Patch, wwwdocs] releasing.html: Update online-doc links of changes.html

2012-03-01 Thread Tobias Burnus
Some of links to the online-documentation in the change.html files tend 
to break after a some months. Thus, it makes sense to change the trunk 
links to branch links.


OK?

Tobias
Index: htdocs/releasing.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/releasing.html,v
retrieving revision 1.35
diff -p -u -r1.35 releasing.html
--- htdocs/releasing.html	25 Oct 2010 22:36:17 -	1.35
+++ htdocs/releasing.html	1 Mar 2012 13:09:53 -
@@ -77,6 +77,9 @@ number inserted).  Link to it from code
 (but don't break URLs to documentation for previous releases even if
 you remove the links to it)./li
 
+liUpdate the online-documentation links in codechanges.html/code
+to point to the online-documentation for the branch./li
+
 liUpdate the main web page (codeindex.html/code)./li
 /ol
 


Re: [Patch, wwwdocs] releasing.html: Update online-doc links of changes.html

2012-03-01 Thread Richard Guenther
On Thu, Mar 1, 2012 at 2:12 PM, Tobias Burnus bur...@net-b.de wrote:
 Some of links to the online-documentation in the change.html files tend to
 break after a some months. Thus, it makes sense to change the trunk links to
 branch links.

 OK?

Ok.

Thanks,
Richard.

 Tobias


Re: [patch testsuite]: Adjust some tests for mingw targets

2012-03-01 Thread Kai Tietz
2012/3/1 Rainer Orth r...@cebitec.uni-bielefeld.de:
 Kai Tietz ktiet...@googlemail.com writes:

 this test adjust some test for mingw targets.

 would you please fix you mailer not to break long lines?  It makes
 reviewing harder.

 Index: gcc.dg/vect/pr46126.c
 ===
 --- gcc.dg/vect/pr46126.c     (revision 184657)
 +++ gcc.dg/vect/pr46126.c     (working copy)
 @@ -1,5 +1,7 @@
  /* { dg-do compile } */

 +__extension__ typedef __SIZE_TYPE__ size_t;

 I think you should use __UINTPTR_TYPE__/uintptr_t instead.

Ok, but in fact it makes for this testcase no difference.

 Index: gcc.dg/format/dfp-scanf-1.c
 ===
 --- gcc.dg/format/dfp-scanf-1.c       (revision 184657)
 +++ gcc.dg/format/dfp-scanf-1.c       (working copy)
 @@ -3,7 +3,7 @@
  /* { dg-do compile } */
  /* { dg-require-effective-target dfp } */
  /* { dg-options -Wformat } */
 -/* { dg-skip-if No scanf/printf dfp support { *-*-mingw* } } */
 +/* { dg-skip-if No scanf/printf dfp support { *-*-mingw* } { * }
 {  } } */


 What's the point of this change?  Why are you explicitly adding the
 defaults?

I made bad expierence by omitting those defaults.  Actual a different
testcase, which also omitted those defaults, were still ran instead of
being skipped.
In most places over testsuite the defaults are specified, too.

        Rainer

Regards,
Kai


[patch changes]: Add new Windows IA-32/x86_64 features

2012-03-01 Thread Kai Tietz
Hi,

this patch adds some of the new features of gcc 4.7 to the changes.html.

Ok for apply?

Regards,
Kai

Index: wwwdocs/htdocs/gcc-4.7/changes.html
===
--- wwwdocs.orig/htdocs/gcc-4.7/changes.html
+++ wwwdocs/htdocs/gcc-4.7/changes.html
@@ -678,6 +678,11 @@ int add_values (const __flash int *p, in
   is available through code-march=core-avx-i/code./li
 liSupport for the new Intel processor codename Haswell with
AVX2, FMA, BMI,
   BMI2, LZCNT is available through code-march=core-avx2/code./li
+liWindows mingw targets are using code-mms-bitfields/code option
+  as default./li
+liWindow x86 target is using code__thiscall/code calling convention
+  for C++ class-member functions./li
+liSupport of code--with-threads=posix/code for Windows
mingw targets./li
 li.../li
   /ul


[Patch,AVR]: Add built-in to get flash segment

2012-03-01 Thread Georg-Johann Lay
This built-in basically returns the high byte of a 24-bit address.

It can be used to test at run time where a pointer points to (Flash or RAM).

Ok for trunk?

Johann

* doc/extend.texi (AVR Built-in Functions): Document
__builtin_avr_flash_segment.

* config/avr/builtins.def (__builtin_avr_flash_segment): New entry.
* config/avr/avr.md (flash_segment, flash_segment1): New expanders.
(*split.flash_segment): New insn-and-split.
* config/avr/avr.c (avr_init_builtins): Add local variables:
const_memx_void_node, const_memx_ptr_type_node,
char_ftype_const_memx_ptr.


Index: doc/extend.texi
===
--- doc/extend.texi	(revision 184739)
+++ doc/extend.texi	(working copy)
@@ -8809,7 +8809,18 @@ might increase delay time. @code{ticks}
 integer constant; delays with a variable number of cycles are not supported.
 
 @smallexample
- unsigned char __builtin_avr_insert_bits (unsigned long map, unsigned char bits, unsigned char val)
+char __builtin_avr_flash_segment (const __memx void*)
+@end smallexample
+
+@noindent
+This built-in takes a byte address to the 24-bit
+@ref{AVR Named Address Spaces,address space} @code{__memx} and returns
+the number of the flash segment (the 64 KiB chunk) where the address
+points to.  Counting starts at @code{0}.
+If the address does not point to flash memory, return @code{-1}.
+
+@smallexample
+unsigned char __builtin_avr_insert_bits (unsigned long map, unsigned char bits, unsigned char val)
 @end smallexample
 
 @noindent
Index: config/avr/builtins.def
===
--- config/avr/builtins.def	(revision 184659)
+++ config/avr/builtins.def	(working copy)
@@ -48,3 +48,4 @@ DEF_BUILTIN (__builtin_avr_fmulsu, 2,
 /* More complex stuff that cannot be mapped 1:1 to an instruction.  */
 DEF_BUILTIN (__builtin_avr_delay_cycles, -1, AVR_BUILTIN_DELAY_CYCLES, void_ftype_ulong, -1)
 DEF_BUILTIN (__builtin_avr_insert_bits, 3, AVR_BUILTIN_INSERT_BITS, uchar_ftype_ulong_uchar_uchar, CODE_FOR_insert_bits)
+DEF_BUILTIN (__builtin_avr_flash_segment, 1, AVR_BUILTIN_FLASH_SEGMENT, char_ftype_const_memx_ptr, CODE_FOR_flash_segment)
Index: config/avr/avr.md
===
--- config/avr/avr.md	(revision 184659)
+++ config/avr/avr.md	(working copy)
@@ -5393,6 +5393,53 @@ (define_insn insert_bits
(set_attr cc clobber)])
 
 
+;; __builtin_avr_flash_segment
+
+;; Just a helper for the next official expander.
+
+(define_expand flash_segment1
+  [(set (match_operand:QI 0 register_operand )
+(subreg:QI (match_operand:PSI 1 register_operand )
+   2))
+   (set (cc0)
+(compare (match_dup 0)
+ (const_int 0)))
+   (set (pc)
+(if_then_else (ge (cc0)
+  (const_int 0))
+  (label_ref (match_operand 2  ))
+  (pc)))
+   (set (match_dup 0)
+(const_int -1))])
+
+(define_expand flash_segment
+  [(parallel [(match_operand:QI 0 register_operand )
+  (match_operand:PSI 1 register_operand )])]
+  
+  {
+rtx label = gen_label_rtx ();
+emit (gen_flash_segment1 (operands[0], operands[1], label));
+emit_label (label);
+DONE;
+  })
+
+;; Actually, it's too late now to work out address spaces known at compiletime.
+;; Best place would be to fold ADDR_SPACE_CONVERT_EXPR in avr_fold_builtin.
+;; However, avr_addr_space_convert can add some built-in knowledge for PSTR
+;; so that ADDR_SPACE_CONVERT_EXPR in the built-in must not be resolved.
+
+(define_insn_and_split *split.flash_segment
+  [(set (match_operand:QI 0 register_operand=d)
+(subreg:QI (lo_sum:PSI (match_operand:QI 1 nonmemory_operand ri)
+   (match_operand:HI 2 register_operand  r))
+   2))]
+  
+  { gcc_unreachable(); }
+  
+  [(set (match_dup 0)
+(match_dup 1))])
+
+
 ;; Parity
 
 ;; Postpone expansion of 16-bit parity to libgcc call until after combine for
Index: config/avr/avr.c
===
--- config/avr/avr.c	(revision 184661)
+++ config/avr/avr.c	(working copy)
@@ -10432,6 +10432,19 @@ avr_init_builtins (void)
 unsigned_char_type_node,
 NULL_TREE);
 
+  tree const_memx_void_node
+  = build_qualified_type (void_type_node,
+  TYPE_QUAL_CONST
+  | ENCODE_QUAL_ADDR_SPACE (ADDR_SPACE_MEMX));
+
+  tree const_memx_ptr_type_node
+  = build_pointer_type_for_mode (const_memx_void_node, PSImode, false);
+  
+  tree char_ftype_const_memx_ptr
+  = build_function_type_list (char_type_node,
+  const_memx_ptr_type_node,
+  NULL);
+
 #define DEF_BUILTIN(NAME, N_ARGS, 

[committed] Fix up cselim regression (PR tree-optimization/52445)

2012-03-01 Thread Jakub Jelinek
Hi!

Before MEM_REF merge, this code tracked just SSA_NAME dereferences, which
have all the same access size and offset.  MEM_REFs with the same SSA_NAME
can have different sizes and/or offsets from the base SSA_NAME.
This patch teaches the non-trapping discovery code to take size/offset
into account (in a simple way, in theory a wider store or multiple
smaller stores could serve as well).  Pre-approved by richi in the PR,
bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2012-03-01  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/52445
* tree-ssa-phiopt.c (struct name_to_bb): Remove ssa_name field,
add ssa_name_ver, offset and size fields and change store field
to bool.
(name_to_bb_hash, name_to_bb_eq): Adjust for the above changes.
(add_or_mark_expr): Likewise.  Only consider previous stores
with the same size and offset.
(nt_init_block): Only look at gimple_assign_single_p stmts,
doesn't look at rhs2.

* gcc.dg/pr52445.c: New test.

--- gcc/tree-ssa-phiopt.c.jj2011-11-10 18:09:12.0 +0100
+++ gcc/tree-ssa-phiopt.c   2012-03-01 12:07:03.925652523 +0100
@@ -1122,9 +1122,10 @@ abs_replacement (basic_block cond_bb, ba
same accesses.  */
 struct name_to_bb
 {
-  tree ssa_name;
+  unsigned int ssa_name_ver;
+  bool store;
+  HOST_WIDE_INT offset, size;
   basic_block bb;
-  unsigned store : 1;
 };
 
 /* The hash table for remembering what we've seen.  */
@@ -1133,23 +1134,26 @@ static htab_t seen_ssa_names;
 /* The set of MEM_REFs which can't trap.  */
 static struct pointer_set_t *nontrap_set;
 
-/* The hash function, based on the pointer to the pointer SSA_NAME.  */
+/* The hash function.  */
 static hashval_t
 name_to_bb_hash (const void *p)
 {
-  const_tree n = ((const struct name_to_bb *)p)-ssa_name;
-  return htab_hash_pointer (n) ^ ((const struct name_to_bb *)p)-store;
+  const struct name_to_bb *n = (const struct name_to_bb *) p;
+  return n-ssa_name_ver ^ (((hashval_t) n-store)  31)
+ ^ (n-offset  6) ^ (n-size  3);
 }
 
-/* The equality function of *P1 and *P2.  SSA_NAMEs are shared, so
-   it's enough to simply compare them for equality.  */
+/* The equality function of *P1 and *P2.  */
 static int
 name_to_bb_eq (const void *p1, const void *p2)
 {
   const struct name_to_bb *n1 = (const struct name_to_bb *)p1;
   const struct name_to_bb *n2 = (const struct name_to_bb *)p2;
 
-  return n1-ssa_name == n2-ssa_name  n1-store == n2-store;
+  return n1-ssa_name_ver == n2-ssa_name_ver
+  n1-store == n2-store
+  n1-offset == n2-offset
+  n1-size == n2-size;
 }
 
 /* We see the expression EXP in basic block BB.  If it's an interesting
@@ -1161,8 +1165,12 @@ static void
 add_or_mark_expr (basic_block bb, tree exp,
  struct pointer_set_t *nontrap, bool store)
 {
+  HOST_WIDE_INT size;
+
   if (TREE_CODE (exp) == MEM_REF
-   TREE_CODE (TREE_OPERAND (exp, 0)) == SSA_NAME)
+   TREE_CODE (TREE_OPERAND (exp, 0)) == SSA_NAME
+   host_integerp (TREE_OPERAND (exp, 1), 0)
+   (size = int_size_in_bytes (TREE_TYPE (exp)))  0)
 {
   tree name = TREE_OPERAND (exp, 0);
   struct name_to_bb map;
@@ -1172,9 +1180,12 @@ add_or_mark_expr (basic_block bb, tree e
 
   /* Try to find the last seen MEM_REF through the same
  SSA_NAME, which can trap.  */
-  map.ssa_name = name;
+  map.ssa_name_ver = SSA_NAME_VERSION (name);
   map.bb = 0;
   map.store = store;
+  map.offset = tree_low_cst (TREE_OPERAND (exp, 1), 0);
+  map.size = size;
+
   slot = htab_find_slot (seen_ssa_names, map, INSERT);
   n2bb = (struct name_to_bb *) *slot;
   if (n2bb)
@@ -1197,9 +1208,11 @@ add_or_mark_expr (basic_block bb, tree e
  else
{
  n2bb = XNEW (struct name_to_bb);
- n2bb-ssa_name = name;
+ n2bb-ssa_name_ver = SSA_NAME_VERSION (name);
  n2bb-bb = bb;
  n2bb-store = store;
+ n2bb-offset = map.offset;
+ n2bb-size = size;
  *slot = n2bb;
}
}
@@ -1219,13 +1232,10 @@ nt_init_block (struct dom_walk_data *dat
 {
   gimple stmt = gsi_stmt (gsi);
 
-  if (is_gimple_assign (stmt))
+  if (gimple_assign_single_p (stmt))
{
  add_or_mark_expr (bb, gimple_assign_lhs (stmt), nontrap_set, true);
  add_or_mark_expr (bb, gimple_assign_rhs1 (stmt), nontrap_set, false);
- if (get_gimple_rhs_num_ops (gimple_assign_rhs_code (stmt))  1)
-   add_or_mark_expr (bb, gimple_assign_rhs2 (stmt), nontrap_set,
- false);
}
 }
 }
--- gcc/testsuite/gcc.dg/pr52445.c.jj   2012-03-01 11:32:41.119917248 +0100
+++ gcc/testsuite/gcc.dg/pr52445.c  2012-03-01 11:32:29.0 +0100
@@ -0,0 +1,15 @@
+/* PR tree-optimization/52445 */
+/* { dg-do compile } */
+/* { dg-options -O2 -ftree-cselim 

Re: [4.8, C++ Patch] PR 52422

2012-03-01 Thread Paolo Carlini

Hi,

On 02/29/2012 06:53 AM, Paolo Carlini wrote:

Daniel noticed a couple other SFINAE issues, which I'm fixing in the
usual straightforward way. Tested x86_64-linux.


When fixing these things, please add checking for error_mark_node 
return as well.  For instance, in this patch the calls to 
decay_conversion from build_conditional_expr_1 could return 
error_mark_node, in which case we want to return out of 
build_conditional_expr_1 as well.  Similarly with the call in 
convert_like_real, and so on.
I see. Thus I added many of those checks, essentially all I could see 
besides some special cases like we call decay_conversion with an 
explicit tf_warning_or_error (thus we have the status quo behavior 
anyway) or when there are already checks, just a few lines below. In the 
feature I'll keep an eye to that.


Does the below look better? (booted and tested x86_64-linux)

PS: while working on the patch, I noticed that a few functions, which in
the meanwhile acquired a tsubst_flags_t parameter, aren't fully
propagating it, are still passing tf_warning_or_error. Apparently a
clean-up is in order.

Please.  :)

Ok, will do (and in case more error_mark_node checks too, of course)

Thanks,
Paolo.

//
Index: testsuite/g++.dg/cpp0x/sfinae33.C
===
--- testsuite/g++.dg/cpp0x/sfinae33.C   (revision 0)
+++ testsuite/g++.dg/cpp0x/sfinae33.C   (revision 0)
@@ -0,0 +1,27 @@
+// PR c++/52422
+// { dg-options -std=c++0x }
+
+templateclass T
+struct add_rval_ref
+{
+  typedef T type;
+};
+
+template
+struct add_rval_refvoid
+{
+  typedef void type;
+};
+
+templateclass T
+typename add_rval_refT::type create();
+
+templateclass T, 
+  class = decltype(createT()())
+
+auto f(int) - char()[1];
+
+templateclass
+auto f(...) - char()[2];
+
+static_assert(sizeof(fvoid(0)) != 1, );
Index: testsuite/g++.dg/cpp0x/sfinae34.C
===
--- testsuite/g++.dg/cpp0x/sfinae34.C   (revision 0)
+++ testsuite/g++.dg/cpp0x/sfinae34.C   (revision 0)
@@ -0,0 +1,28 @@
+// PR c++/52422
+// { dg-options -std=c++0x }
+
+templateclass T
+struct add_rval_ref
+{
+  typedef T type;
+};
+
+template
+struct add_rval_refvoid
+{
+  typedef void type;
+};
+
+templateclass T
+typename add_rval_refT::type create();
+
+templateclass T, class U,
+  class = decltype( (createT().*createU())() )
+
+auto f(int) - char()[1];
+
+templateclass, class
+auto f(...) - char()[2];
+
+static_assert(sizeof(fvoid, void(0)) != 1, );
+
Index: cp/typeck.c
===
--- cp/typeck.c (revision 184739)
+++ cp/typeck.c (working copy)
@@ -1813,7 +1813,7 @@ unlowered_expr_type (const_tree exp)
that the return value is no longer an lvalue.  */
 
 tree
-decay_conversion (tree exp)
+decay_conversion (tree exp, tsubst_flags_t complain)
 {
   tree type;
   enum tree_code code;
@@ -1827,7 +1827,8 @@ tree
   exp = resolve_nondeduced_context (exp);
   if (type_unknown_p (exp))
 {
-  cxx_incomplete_type_error (exp, TREE_TYPE (exp));
+  if (complain  tf_error)
+   cxx_incomplete_type_error (exp, TREE_TYPE (exp));
   return error_mark_node;
 }
 
@@ -1846,13 +1847,14 @@ tree
   code = TREE_CODE (type);
   if (code == VOID_TYPE)
 {
-  error (void value not ignored as it ought to be);
+  if (complain  tf_error)
+   error (void value not ignored as it ought to be);
   return error_mark_node;
 }
-  if (invalid_nonstatic_memfn_p (exp, tf_warning_or_error))
+  if (invalid_nonstatic_memfn_p (exp, complain))
 return error_mark_node;
   if (code == FUNCTION_TYPE || is_overloaded_fn (exp))
-return cp_build_addr_expr (exp, tf_warning_or_error);
+return cp_build_addr_expr (exp, complain);
   if (code == ARRAY_TYPE)
 {
   tree adr;
@@ -1864,7 +1866,9 @@ tree
 
   if (TREE_CODE (exp) == COMPOUND_EXPR)
{
- tree op1 = decay_conversion (TREE_OPERAND (exp, 1));
+ tree op1 = decay_conversion (TREE_OPERAND (exp, 1), complain);
+ if (op1 == error_mark_node)
+return error_mark_node;
  return build2 (COMPOUND_EXPR, TREE_TYPE (op1),
 TREE_OPERAND (exp, 0), op1);
}
@@ -1872,7 +1876,8 @@ tree
   if (!lvalue_p (exp)
   ! (TREE_CODE (exp) == CONSTRUCTOR  TREE_STATIC (exp)))
{
- error (invalid use of non-lvalue array);
+ if (complain  tf_error)
+   error (invalid use of non-lvalue array);
  return error_mark_node;
}
 
@@ -1887,7 +1892,7 @@ tree
}
   /* This way is better for a COMPONENT_REF since it can
 simplify the offset for a component.  */
-  adr = cp_build_addr_expr (exp, tf_warning_or_error);
+  adr = cp_build_addr_expr (exp, complain);
   return cp_convert (ptrtype, adr);
 }
 
@@ -1939,7 +1944,7 @@ default_conversion (tree exp)
   else if 

Re: [patch changes]: Add new Windows IA-32/x86_64 features

2012-03-01 Thread Gerald Pfeifer
On Thu, 1 Mar 2012, Kai Tietz wrote:
 +liWindows mingw targets are using code-mms-bitfields/code option
 +  as default./li

are using the (add the) and probably by default

 +liWindow x86 target is using code__thiscall/code calling convention
 +  for C++ class-member functions./li

The Windows x86 or Windows x86 targets are (in any case, add s to
Window :-).

the...calling convention

 +liSupport of code--with-threads=posix/code for Windows
 mingw targets./li

Is this a configure option?  In that case I'd say Support for the
... configure option... to make this clear.

Thanks for taking the time to write this up!  The patch is fine with
the above, or comparable changes.

Gerald


RE: [Patch,AVR]: Add built-in to get flash segment

2012-03-01 Thread Weddington, Eric


 -Original Message-
 From: Georg-Johann Lay [mailto:a...@gjlay.de]
 Sent: Thursday, March 01, 2012 6:53 AM
 To: gcc-patches@gcc.gnu.org
 Cc: Denis Chertykov; Weddington, Eric
 Subject: [Patch,AVR]: Add built-in to get flash segment
 
 This built-in basically returns the high byte of a 24-bit address.
 
 It can be used to test at run time where a pointer points to (Flash or
RAM).
 
 Ok for trunk?
 

Please commit, thanks!

Eric


Re: [Patch ARM] Fix PR 49069.

2012-03-01 Thread Matthew Gretton-Dann
PING.

On Tue, Jan 24, 2012 at 04:10:19PM +, Sameera Deshpande wrote:
 Hi,
 
 Please find attached the patch fixing bug 49069.
 
 This patch is tested with check-gcc on trunk and 4.6 without regression.
 OK for trunk?
 Is it fine to backport to 4.6 branch?
 
 ChangeLog:
 2012-01-24  Sameera Deshpande  sameera.deshpa...@arm.com
 PR target/49069
 gcc/config/arm/arm.md (cstoredi4): Handle the case when both
 operands are const_int.
 
 gcc/testsuite/ChangeLog:
 2012-01-24  Sameera Deshpande  sameera.deshpa...@arm.com
 PR target/49069
 gcc.target/arm/pr49069.c: New compile-only test.
 
 - Thanks and regards,
   Sameera D.

 diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
 index 751997f..e3dc98f 100644
 --- a/gcc/config/arm/arm.md
 +++ b/gcc/config/arm/arm.md
 @@ -7911,8 +7911,9 @@
   enum rtx_code code = GET_CODE (operands[1]);
  
   /* We should not have two constants.  */
 - gcc_assert (GET_MODE (operands[2]) == DImode
 -  || GET_MODE (operands[3]) == DImode);
 + if (!(GET_MODE (operands[2]) == DImode || GET_MODE (operands[3]) == 
 DImode)
 +  !(reload_in_progress || reload_completed))
 +   operands[3] = force_reg (DImode, operands[3]);
  
  /* Flip unimplemented DImode comparisons to a form that
 arm_gen_compare_reg can handle.  */
 diff --git a/gcc/testsuite/gcc.target/arm/pr49069.c 
 b/gcc/testsuite/gcc.target/arm/pr49069.c
 new file mode 100644
 index 000..3cc903e
 --- /dev/null
 +++ b/gcc/testsuite/gcc.target/arm/pr49069.c
 @@ -0,0 +1,24 @@
 +/* { dg-do compile } */
 +/* { dg-options -Os -mfloat-abi=softfp -mfpu=vfpv3-d16 } */
 +
 +__extension__ typedef unsigned long long int uint64_t;
 +
 +static int
 +func2 (int a, int b)
 +{
 +  return a == 0 ? a : a / b;
 +}
 +
 +int array1[1];
 +const uint64_t array2[1] = { 1 };
 +
 +void
 +foo (void)
 +{
 +  for (array1[0] = 0; array1[0] == 1; array1[0]++)
 +{
 +}
 +  if (bar (array2[0] == func2 (array1[0], 0)) == 0)
 +{
 +}
 +}

-- 
Matthew Gretton-Dann
Principal Engineer, PD Software, ARM Ltd.



Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Joseph S. Myers
On Thu, 1 Mar 2012, Kai Tietz wrote:

 Thanks, I adjusted ChangeLog, comment, and added the copyright year.
 It would be kind, if somebody could apply this patch to glibc's
 repository as I don't have commit access to it.  I can do the applying
 to gcc's tree, if patch is ok-ed.

This patch doesn't apply cleanly.  Please resend in a way that does not 
munge any of the whitespace in the patch (including at ends of lines), 
maybe as an attachment.

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


Re: [Patch ARM] Fix PR 49069.

2012-03-01 Thread Richard Earnshaw
On 01/03/12 15:28, Matthew Gretton-Dann wrote:
 PING.
 

Sorry, I don't think this is right.  Why is gen_cstoredi being called
with two constants in a comparison?  If both operands are constant then
the comparison is deterministic and we don't need a cstore operation.

R.

 On Tue, Jan 24, 2012 at 04:10:19PM +, Sameera Deshpande wrote:
 Hi,

 Please find attached the patch fixing bug 49069.

 This patch is tested with check-gcc on trunk and 4.6 without regression.
 OK for trunk?
 Is it fine to backport to 4.6 branch?

 ChangeLog:
 2012-01-24  Sameera Deshpande  sameera.deshpa...@arm.com
 PR target/49069
 gcc/config/arm/arm.md (cstoredi4): Handle the case when both
 operands are const_int.

 gcc/testsuite/ChangeLog:
 2012-01-24  Sameera Deshpande  sameera.deshpa...@arm.com
 PR target/49069
 gcc.target/arm/pr49069.c: New compile-only test.

 - Thanks and regards,
   Sameera D.
 
 diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
 index 751997f..e3dc98f 100644
 --- a/gcc/config/arm/arm.md
 +++ b/gcc/config/arm/arm.md
 @@ -7911,8 +7911,9 @@
   enum rtx_code code = GET_CODE (operands[1]);
  
   /* We should not have two constants.  */
 - gcc_assert (GET_MODE (operands[2]) == DImode
 - || GET_MODE (operands[3]) == DImode);
 + if (!(GET_MODE (operands[2]) == DImode || GET_MODE (operands[3]) == 
 DImode)
 +  !(reload_in_progress || reload_completed))
 +   operands[3] = force_reg (DImode, operands[3]);
  
  /* Flip unimplemented DImode comparisons to a form that
 arm_gen_compare_reg can handle.  */
 diff --git a/gcc/testsuite/gcc.target/arm/pr49069.c 
 b/gcc/testsuite/gcc.target/arm/pr49069.c
 new file mode 100644
 index 000..3cc903e
 --- /dev/null
 +++ b/gcc/testsuite/gcc.target/arm/pr49069.c
 @@ -0,0 +1,24 @@
 +/* { dg-do compile } */
 +/* { dg-options -Os -mfloat-abi=softfp -mfpu=vfpv3-d16 } */
 +
 +__extension__ typedef unsigned long long int uint64_t;
 +
 +static int
 +func2 (int a, int b)
 +{
 +  return a == 0 ? a : a / b;
 +}
 +
 +int array1[1];
 +const uint64_t array2[1] = { 1 };
 +
 +void
 +foo (void)
 +{
 +  for (array1[0] = 0; array1[0] == 1; array1[0]++)
 +{
 +}
 +  if (bar (array2[0] == func2 (array1[0], 0)) == 0)
 +{
 +}
 +}
 




Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Kai Tietz
2012/3/1 Joseph S. Myers jos...@codesourcery.com:
 On Thu, 1 Mar 2012, Kai Tietz wrote:

 Thanks, I adjusted ChangeLog, comment, and added the copyright year.
 It would be kind, if somebody could apply this patch to glibc's
 repository as I don't have commit access to it.  I can do the applying
 to gcc's tree, if patch is ok-ed.

 This patch doesn't apply cleanly.  Please resend in a way that does not
 munge any of the whitespace in the patch (including at ends of lines),
 maybe as an attachment.

Ok, as attachment.

Regards,
Kai
Index: soft-fp/extended.h
===
--- soft-fp/extended.h  (revision 184686)
+++ soft-fp/extended.h  (working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Extended Precision.
-   Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1999,2006,2007, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek (j...@ultra.linux.cz).
 
@@ -64,7 +64,7 @@
 union _FP_UNION_E
 {
XFtype flt;
-   struct 
+   struct _FP_STRUCT_LAYOUT
{
 #if __BYTE_ORDER == __BIG_ENDIAN
   unsigned long pad1 : _FP_W_TYPE_SIZE;
@@ -263,7 +263,7 @@
 union _FP_UNION_E
 {
   XFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 _FP_W_TYPE pad  : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
 unsigned sign   : 1;
Index: soft-fp/single.h
===
--- soft-fp/single.h(revision 184686)
+++ soft-fp/single.h(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Single Precision.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
  Jakub Jelinek (j...@ultra.linux.cz),
@@ -58,7 +58,7 @@
 union _FP_UNION_S
 {
   SFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign : 1;
 unsigned exp  : _FP_EXPBITS_S;
Index: soft-fp/double.h
===
--- soft-fp/double.h(revision 184686)
+++ soft-fp/double.h(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Double Precision
-   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009
+   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009, 2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
@@ -68,7 +68,7 @@
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign  : 1;
 unsigned exp   : _FP_EXPBITS_D;
@@ -167,7 +167,7 @@
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign   : 1;
 unsigned exp: _FP_EXPBITS_D;
Index: soft-fp/quad.h
===
--- soft-fp/quad.h  (revision 184686)
+++ soft-fp/quad.h  (working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Quad Precision.
-   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
  Jakub Jelinek (j...@ultra.linux.cz),
@@ -67,7 +67,7 @@
 union _FP_UNION_Q
 {
TFtype flt;
-   struct 
+   struct _FP_STRUCT_LAYOUT
{
 #if __BYTE_ORDER == __BIG_ENDIAN
   unsigned sign : 1;
@@ -171,10 +171,11 @@
 union _FP_UNION_Q
 {
   TFtype flt /* __attribute__((mode(TF))) */ ;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 _FP_W_TYPE a, b;
   } longs;
-  struct {
+  struct _FP_STRUCT_LAYOUT
+  {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign: 1;
 unsigned exp : _FP_EXPBITS_Q;
Index: soft-fp/soft-fp.h
===
--- soft-fp/soft-fp.h   (revision 184686)
+++ soft-fp/soft-fp.h   (working copy)
@@ -1,5 +1,5 @@
 /* Software floating-point emulation.
-   Copyright (C) 1997,1998,1999,2000,2002,2003,2005,2006
+   Copyright (C) 1997,1998,1999,2000,2002,2003,2005,2006, 2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
@@ -85,6 +85,13 @@
 #define FP_EX_DENORM   0
 #endif
 
+/* By _FP_STRUCT_LAYOUT you can specify to be used struct-layout
+   variant.  This is required for mingw targets, which are using
+   a specific struct-layout with differences in consecutive bit-fields.  */
+#ifndef _FP_STRUCT_LAYOUT
+#define _FP_STRUCT_LAYOUT

Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Joseph S. Myers
On Thu, 1 Mar 2012, Kai Tietz wrote:

 2012/3/1 Joseph S. Myers jos...@codesourcery.com:
  On Thu, 1 Mar 2012, Kai Tietz wrote:
 
  Thanks, I adjusted ChangeLog, comment, and added the copyright year.
  It would be kind, if somebody could apply this patch to glibc's
  repository as I don't have commit access to it. ?I can do the applying
  to gcc's tree, if patch is ok-ed.
 
  This patch doesn't apply cleanly. ?Please resend in a way that does not
  munge any of the whitespace in the patch (including at ends of lines),
  maybe as an attachment.
 
 Ok, as attachment.

This still didn't apply cleanly because it appeared you had diffed against 
the copy of the files in GCC and not the version in glibc's git repository 
where one file had an updated copyright header since it was last imported 
into GCC.  In general you need to produce diffs relative to the mainline 
sources of the project to which you are submitting changes, not some other 
project or some other branch.

I've applied the patch to glibc in this version.  For GCC, you should 
*not* make the changes by applying a patch and committing the results; you 
should copy the current versions of all shared soft-fp files from glibc's 
git repository and check in the result of that copying, so getting any 
other changes that have been applied to those files in glibc as well.

diff --git a/ChangeLog b/ChangeLog
index e2bc926..a2e0d6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-03-01  Kai Tietz  kti...@redhat.com
+
+   * soft-fp/soft-fp.h (_FP_STRUCT_LAYOUT): New macro.
+   * soft-fp/quad.h (_FP_UNION_Q): Use _FP_STRUCT_LAYOUT on struct
+   containing bit-fields.
+   * soft-fp/extended.h (_FP_UNION_E): Likewise.
+   * soft-fp/single.h (_FP_UNION_S): Likewise.
+   * soft-fp/double.h (_FP_UNION_D): Likewise.
+
 2012-02-29  Joseph Myers  jos...@codesourcery.com
 
[BZ #13786]
diff --git a/soft-fp/double.h b/soft-fp/double.h
index e247e6e..5bad49c 100644
--- a/soft-fp/double.h
+++ b/soft-fp/double.h
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Double Precision
-   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009
+   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009, 2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
@@ -67,7 +67,7 @@ typedef float DFtype __attribute__((mode(DF)));
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign  : 1;
 unsigned exp   : _FP_EXPBITS_D;
@@ -166,7 +166,7 @@ union _FP_UNION_D
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign   : 1;
 unsigned exp: _FP_EXPBITS_D;
diff --git a/soft-fp/extended.h b/soft-fp/extended.h
index 3ab6b6a..af9c6e6 100644
--- a/soft-fp/extended.h
+++ b/soft-fp/extended.h
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Extended Precision.
-   Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1999,2006,2007,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek (j...@ultra.linux.cz).
 
@@ -63,7 +63,7 @@ typedef float XFtype __attribute__((mode(XF)));
 union _FP_UNION_E
 {
XFtype flt;
-   struct 
+   struct _FP_STRUCT_LAYOUT
{
 #if __BYTE_ORDER == __BIG_ENDIAN
   unsigned long pad1 : _FP_W_TYPE_SIZE;
@@ -262,7 +262,7 @@ union _FP_UNION_E
 union _FP_UNION_E
 {
   XFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 _FP_W_TYPE pad  : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
 unsigned sign   : 1;
diff --git a/soft-fp/quad.h b/soft-fp/quad.h
index ea70138..b05bd2d 100644
--- a/soft-fp/quad.h
+++ b/soft-fp/quad.h
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Quad Precision.
-   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
  Jakub Jelinek (j...@ultra.linux.cz),
@@ -66,7 +66,7 @@ typedef float TFtype __attribute__((mode(TF)));
 union _FP_UNION_Q
 {
TFtype flt;
-   struct 
+   struct _FP_STRUCT_LAYOUT
{
 #if __BYTE_ORDER == __BIG_ENDIAN
   unsigned sign : 1;
@@ -170,10 +170,10 @@ union _FP_UNION_Q
 union _FP_UNION_Q
 {
   TFtype flt /* __attribute__((mode(TF))) */ ;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 _FP_W_TYPE a, b;
   } longs;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign: 1;
 unsigned exp : _FP_EXPBITS_Q;
diff --git a/soft-fp/single.h b/soft-fp/single.h
index c10d25a..119d0db 100644
--- a/soft-fp/single.h
+++ b/soft-fp/single.h
@@ -1,6 +1,6 @@
 /* Software 

[PR52417] restore get_addr behavior for passes other than VT

2012-03-01 Thread Alexandre Oliva
The PR52001 alias.c patch meant to avoid infinite recursion among
permanent equivalences within VTA introduced some relatively expensive
behavior that showed up as (apparently?)-infinite recursion within dse
on AVR for one gcc.c-torture/compile test.

This patch reworks get_addr so that it behaves exactly as before when
permanent equivalences are not in use (i.e., any pass other than var
tracking) and retains the heuristics that avoids infinite recursion only
when permanent equivalences are present, when needed.

Regstrapped on x86_64-linux-gnu and i686-pc-linux-gnu, compile-time
tested for the given AVR testcase, approved (minus the comment before
the newly-added function) by Jakub in bugzilla, checking in.

for  gcc/ChangeLog
from  Alexandre Oliva  aol...@redhat.com

	PR debug/52001
	PR rtl-optimization/52417
	* cselib.c (cselib_any_perm_equivs): New variable.
	(cselib_reset_table): Check that it's not set when not
	preserving constants.
	(cselib_add_permanent_equiv): Set it.
	(cselib_have_permanent_equivalences): New.
	(cselib_init, cselib_finish): Reset it.
	* cselib.h (cselib_have_permanent_equivalences): Declare.
	* alias.c (get_addr): Restore earlier behavior when there
	aren't permanent equivalences.

Index: gcc/alias.c
===
--- gcc/alias.c.orig	2012-03-01 04:25:47.348625625 -0300
+++ gcc/alias.c	2012-03-01 07:49:11.0 -0300
@@ -1811,20 +1811,34 @@ get_addr (rtx x)
   v = CSELIB_VAL_PTR (x);
   if (v)
 {
-  v = canonical_cselib_val (v);
+  bool have_equivs = cselib_have_permanent_equivalences ();
+  if (have_equivs)
+	v = canonical_cselib_val (v);
   for (l = v-locs; l; l = l-next)
 	if (CONSTANT_P (l-loc))
 	  return l-loc;
   for (l = v-locs; l; l = l-next)
-	if (!REG_P (l-loc)  !MEM_P (l-loc)  GET_CODE (l-loc) != VALUE
-	 !refs_newer_value_p (l-loc, x))
+	if (!REG_P (l-loc)  !MEM_P (l-loc)
+	/* Avoid infinite recursion when potentially dealing with
+	   var-tracking artificial equivalences, by skipping the
+	   equivalences themselves, and not choosing expressions
+	   that refer to newer VALUEs.  */
+	 (!have_equivs
+		|| (GET_CODE (l-loc) != VALUE
+		 !refs_newer_value_p (l-loc, x
 	  return l-loc;
-  for (l = v-locs; l; l = l-next)
-	if (REG_P (l-loc) || (GET_CODE (l-loc) != VALUE
-			!refs_newer_value_p (l-loc, x)))
-	  return l-loc;
-  /* Return the canonical value.  */
-  return v-val_rtx;
+  if (have_equivs)
+	{
+	  for (l = v-locs; l; l = l-next)
+	if (REG_P (l-loc)
+		|| (GET_CODE (l-loc) != VALUE
+		 !refs_newer_value_p (l-loc, x)))
+	  return l-loc;
+	  /* Return the canonical value.  */
+	  return v-val_rtx;
+	}
+  if (v-locs)
+	return v-locs-loc;
 }
   return x;
 }
Index: gcc/cselib.c
===
--- gcc/cselib.c.orig	2012-03-01 07:44:32.426668955 -0300
+++ gcc/cselib.c	2012-03-01 13:15:07.0 -0300
@@ -52,6 +52,7 @@ struct elt_list {
 
 static bool cselib_record_memory;
 static bool cselib_preserve_constants;
+static bool cselib_any_perm_equivs;
 static int entry_and_rtx_equal_p (const void *, const void *);
 static hashval_t get_value_hash (const void *);
 static struct elt_list *new_elt_list (struct elt_list *, cselib_val *);
@@ -477,7 +478,10 @@ cselib_reset_table (unsigned int num)
   if (cselib_preserve_constants)
 htab_traverse (cselib_hash_table, preserve_constants_and_equivs, NULL);
   else
-htab_empty (cselib_hash_table);
+{
+  htab_empty (cselib_hash_table);
+  gcc_checking_assert (!cselib_any_perm_equivs);
+}
 
   n_useless_values = 0;
   n_useless_debug_values = 0;
@@ -2388,6 +2392,8 @@ cselib_add_permanent_equiv (cselib_val *
 
   if (nelt != elt)
 {
+  cselib_any_perm_equivs = true;
+
   if (!PRESERVED_VALUE_P (nelt-val_rtx))
 	cselib_preserve_value (nelt);
 
@@ -2397,6 +2403,14 @@ cselib_add_permanent_equiv (cselib_val *
   cselib_current_insn = save_cselib_current_insn;
 }
 
+/* Return TRUE if any permanent equivalences have been recorded since
+   the table was last initialized.  */
+bool
+cselib_have_permanent_equivalences (void)
+{
+  return cselib_any_perm_equivs;
+}
+
 /* There is no good way to determine how many elements there can be
in a PARALLEL.  Since it's fairly cheap, use a really large number.  */
 #define MAX_SETS (FIRST_PSEUDO_REGISTER * 2)
@@ -2651,6 +2665,7 @@ cselib_init (int record_what)
   value_pool = create_alloc_pool (value, RTX_CODE_SIZE (VALUE), 100);
   cselib_record_memory = record_what  CSELIB_RECORD_MEMORY;
   cselib_preserve_constants = record_what  CSELIB_PRESERVE_CONSTANTS;
+  cselib_any_perm_equivs = false;
 
   /* (mem:BLK (scratch)) is a special mechanism to conflict with everything,
  see canon_true_dependence.  This is only created once.  */
@@ -2684,6 +2699,7 @@ cselib_finish (void)
 {
   cselib_discard_hook = NULL;
   cselib_preserve_constants = false;
+  

Re: [PATCH][ARM] NEON DImode not

2012-03-01 Thread Richard Earnshaw
On 01/03/12 12:57, Andrew Stubbs wrote:
 On Wed 29 Feb 2012 18:00:19 GMT, Richard Earnshaw wrote:
 Why can't we have a single insn that deals with the have-neon and
 dont-have-neon cases?
 
 Sorry, I'm not sure I follow?
 
 There's one insn for the have-neon case, and one for the 
 don't-have-neon. The expander is necessary to prevent gen_one_cmpldi2 
 locking recog to a disabled pattern (it caches the recog result, I think).
 
 It would be possible to have the arm.md insn emit NEON instructions, but 
 that's not the usual practice, I think? The neon.md isns could also emit 
 arm/thumb2 instructions, but there's no real point since there are 
 already two different splitters for that.
 
 Andrew
 
The RTL part of one_cmpldi2_internal and one_cmpldi2_neon are the same.
 Given that we now have controls to determine when an alternative is
enabled it's generally better to have just one pattern here and turn on
the alternatives that are suitable rather than having multiple patterns.

You're already half doing this with the nota8 and onlya8 controls.

R.



Go patch committed: Fix varargs function that call recover

2012-03-01 Thread Ian Lance Taylor
The Go frontend mishandled varargs functions that call recover.  This
patch fixes that.  The patch also fixes a couple of other cases where
the compiler crashed on invalid input.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 0927d16a6df2 go/expressions.h
--- a/go/expressions.h	Wed Feb 29 21:59:00 2012 -0800
+++ b/go/expressions.h	Thu Mar 01 09:10:10 2012 -0800
@@ -1066,6 +1066,10 @@
   { return this-expr_; }
 
  protected:
+  int
+  do_traverse(Traverse* traverse)
+  { return Expression::traverse(this-expr_, traverse); }
+
   Type*
   do_type();
 
diff -r 0927d16a6df2 go/gogo.cc
--- a/go/gogo.cc	Wed Feb 29 21:59:00 2012 -0800
+++ b/go/gogo.cc	Thu Mar 01 09:10:10 2012 -0800
@@ -2500,6 +2500,9 @@
 
   Call_expression* call = Expression::make_call(fn, args, false, location);
 
+  // Any varargs call has already been lowered.
+  call-set_varargs_are_lowered();
+
   Statement* s;
   if (orig_fntype-results() == NULL || orig_fntype-results()-empty())
 s = Statement::make_statement(call, true);
@@ -5346,5 +5349,5 @@
   else if (this-var_ != NULL)
 this-var_-add_preinit_statement(this-gogo_, s);
   else
-go_unreachable();
-}
+go_assert(saw_errors());
+}


libgo patch committed: Define MADV_ constants for madvise

2012-03-01 Thread Ian Lance Taylor
This patch to libgo's mksysinfo shell script defines the MADV_ constants
use by the syscall.Madvise function.  Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 2af6279334e7 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Thu Mar 01 09:10:52 2012 -0800
+++ b/libgo/mksysinfo.sh	Thu Mar 01 09:20:56 2012 -0800
@@ -191,6 +191,8 @@
   sed -e 's/^\(const \)_\(PROT_[^= ]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
 grep '^const _MAP_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\(MAP_[^= ]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
+grep '^const _MADV_' gen-sysinfo.go | \
+  sed -e 's/^\(const \)_\(MADV_[^= ]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
 
 # Process status constants.
 grep '^const _W' gen-sysinfo.go |


Re: [patch testsuite]: Adjust some tests for mingw targets

2012-03-01 Thread Rainer Orth
Kai Tietz ktiet...@googlemail.com writes:

 So updated patch (sorry the gmail-mailer breaks lines up here, and I
 can't configure it for not doing so.  So I attached patch, too).

Ok.  In the future, please indicate on which platforms and how you
tested the patch.  mingw and x86_64-linux, I assume?

 2012-03-01  Kai Tietz  kti...@redhat.com

   * gcc.dg/torture/pr47917.c: Make test using POSIX-printf
   routines on mingw targets.
   * gcc.dg/vect/pr46126.c (size_t): Add support for

Please update for the uintptr_t change.

   LLP64 target.

 Ok for apply?

Ok with that change, provided appropriate testing.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


[lra] a patch to fix s390 bootstrap

2012-03-01 Thread Vladimir Makarov

The following patch finally fixes s390 bootstrap.

The patch was successfully bootstrapped on s390x, x86/x86-64, power7, 
arm, sparc64, and ia64.


Committed as rev. 184749.

2012-03-01  Vladimir Makarov vmaka...@redhat.com

* lra-lives.c (pseudos_live_through_calls): New sparseset.
(pseudos_live_through_setjumps): Ditto.
(check_pseudos_live_through_calls): New function.
(process_bb_lives): Use the sparsesets and the function.
(lra_create_live_ranges): Allocate and free sparsesets
pseudos_live_through_calls and pseudos_live_through_setjumps.

* lra-constraints.c (check_and_process_move): Try secondary reload
for source and destination.

* jump.c (true_regnum): Use hard_regno for subreg_get_info when
lra is in progress.



Index: lra-lives.c
===
--- lra-lives.c (revision 184177)
+++ lra-lives.c (working copy)
@@ -69,6 +69,16 @@ static int curr_point;
 /* Pseudos live at current point in the scan.  */
 static sparseset pseudos_live;
 
+/* Pseudos probably living through calls and setjumps.  As setjump is
+   a call too, if a bit in PSEUDOS_LIVE_THROUGH_SETJUMPS is set up
+   then the corresponding bit in PSEUDOS_LIVE_THROUGH_CALLS is set up
+   too.  These data are necessary for cases when only one subreg of a
+   multi-reg pseudo is set up after a call.  So we decide it is
+   probably live when traversing bb backward.  We are sure about
+   living when we see its usage or definition of the pseudo.  */
+static sparseset pseudos_live_through_calls;
+static sparseset pseudos_live_through_setjumps;
+
 /* Set of hard regs (except eliminable ones) currently live.  */
 static HARD_REG_SET hard_regs_live;
 
@@ -466,6 +476,28 @@ lra_setup_reload_pseudo_preferenced_hard
 }
 }
 
+/* Check that REGNO living through calls and setjumps, set up conflict
+   regs, and clear corresponding bits in PSEUDOS_LIVE_THROUGH_CALLS and
+   PSEUDOS_LIVE_THROUGH_SETJUMPS.  */
+static inline void
+check_pseudos_live_through_calls (int regno)
+{
+  if (! sparseset_bit_p (pseudos_live_through_calls, regno))
+return;
+  sparseset_clear_bit (pseudos_live_through_calls, regno);
+  IOR_HARD_REG_SET (lra_reg_info[regno].conflict_hard_regs,
+   call_used_reg_set);
+#ifdef ENABLE_CHECKING
+  lra_reg_info[regno].call_p = true;
+#endif
+  if (! sparseset_bit_p (pseudos_live_through_setjumps, regno))
+return;
+  sparseset_clear_bit (pseudos_live_through_setjumps, regno);
+  /* Don't allocate pseudos that cross setjmps or any call, if this
+ function receives a nonlocal goto.  */
+  SET_HARD_REG_SET (lra_reg_info[regno].conflict_hard_regs);
+}
+
 /* Process insns of the basic block BB to update pseudo live ranges,
pseudo hard register conflicts.  */
 static void
@@ -480,6 +512,8 @@ process_bb_lives (basic_block bb)
 
   reg_live_out = DF_LR_OUT (bb);
   sparseset_clear (pseudos_live);
+  sparseset_clear (pseudos_live_through_calls);
+  sparseset_clear (pseudos_live_through_setjumps);
   REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out);
   AND_COMPL_HARD_REG_SET (hard_regs_live, eliminable_regset);
   AND_COMPL_HARD_REG_SET (hard_regs_live, lra_no_alloc_regs);
@@ -571,7 +605,10 @@ process_bb_lives (basic_block bb)
 that are live at the time of the definition.  */
   for (reg = curr_id-regs; reg != NULL; reg = reg-next)
if (reg-type != OP_IN)
- mark_regno_live (reg-regno, reg-biggest_mode);
+ {
+   mark_regno_live (reg-regno, reg-biggest_mode);
+   check_pseudos_live_through_calls (reg-regno);
+ }
 
   for (reg = curr_static_id-hard_regs; reg != NULL; reg = reg-next)
if (reg-type != OP_IN)
@@ -596,22 +633,13 @@ process_bb_lives (basic_block bb)
 
   if (call_p)
{
- /* The current set of live pseudos are live across the
-call.  */
- EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, i)
-   {
- /* Don't allocate pseudos that cross setjmps or any
-call, if this function receives a nonlocal goto.  */
- if (cfun-has_nonlocal_label
- || find_reg_note (curr_insn, REG_SETJMP,
-   NULL_RTX) != NULL_RTX)
-   SET_HARD_REG_SET (lra_reg_info[i].conflict_hard_regs);
- IOR_HARD_REG_SET (lra_reg_info[i].conflict_hard_regs,
-   call_used_reg_set);
-#ifdef ENABLE_CHECKING
- lra_reg_info[i].call_p = true;
-#endif
-   }
+ sparseset_ior (pseudos_live_through_calls,
+pseudos_live_through_calls, pseudos_live);
+ if (cfun-has_nonlocal_label
+ || find_reg_note (curr_insn, REG_SETJMP,
+   NULL_RTX) != NULL_RTX)
+   sparseset_ior (pseudos_live_through_setjumps,
+  pseudos_live_through_setjumps, pseudos_live);
  

Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Kai Tietz
Hello,

Thanks and sorry for the troubles I caused.  Next time I will prepare
patches for it against glibc's developer repository.

As I understand the README file in soft-fp, just those files affected
by my patch need to be merged from glibc.

As the mingw targets are using by defaul ms-struct layout, the
following patch is
required to fix floating-point-software-emulation failures caused by
difference in
handling consecutive bitfields with different types.

ChangeLog

2012-03-01  Kai Tietz  kti...@redhat.com

* soft-fp/extended.h: Imported from glibc upstream.
* soft-fp/float.h: Likewise.
* soft-fp/single.h: Likewise
* soft-fp/double.h: Likewise
* soft-fp/soft-fp.h: Likewise.

Ok for apply ?

Regards,
Kai

Index: soft-fp/extended.h
===
--- soft-fp/extended.h  (revision 184753)
+++ soft-fp/extended.h  (working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Extended Precision.
-   Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
+   Copyright (C) 1999,2006,2007,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek (j...@ultra.linux.cz).

@@ -24,9 +24,8 @@
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   License along with the GNU C Library; if not, see
+   http://www.gnu.org/licenses/.  */

 #if _FP_W_TYPE_SIZE  32
 #error Here's a nickel, kid. Go buy yourself a real computer.
@@ -64,7 +63,7 @@
 union _FP_UNION_E
 {
XFtype flt;
-   struct
+   struct _FP_STRUCT_LAYOUT
{
 #if __BYTE_ORDER == __BIG_ENDIAN
   unsigned long pad1 : _FP_W_TYPE_SIZE;
@@ -263,7 +262,7 @@
 union _FP_UNION_E
 {
   XFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 _FP_W_TYPE pad  : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
 unsigned sign   : 1;
Index: soft-fp/single.h
===
--- soft-fp/single.h(revision 184753)
+++ soft-fp/single.h(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Single Precision.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
  Jakub Jelinek (j...@ultra.linux.cz),
@@ -27,9 +27,8 @@
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   License along with the GNU C Library; if not, see
+   http://www.gnu.org/licenses/.  */

 #if _FP_W_TYPE_SIZE  32
 #error Here's a nickel kid.  Go buy yourself a real computer.
@@ -58,7 +57,7 @@
 union _FP_UNION_S
 {
   SFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign : 1;
 unsigned exp  : _FP_EXPBITS_S;
Index: soft-fp/double.h
===
--- soft-fp/double.h(revision 184753)
+++ soft-fp/double.h(working copy)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
Definitions for IEEE Double Precision
-   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009
+   Copyright (C) 1997, 1998, 1999, 2006, 2007, 2008, 2009, 2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (r...@cygnus.com),
@@ -28,9 +28,8 @@
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, USA.  */
+   License along with the GNU C Library; if not, see
+   http://www.gnu.org/licenses/.  */

 #if _FP_W_TYPE_SIZE  32
 #error Here's a nickel kid.  Go buy yourself a real computer.
@@ -68,7 +67,7 @@
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign  : 1;
 unsigned exp   : _FP_EXPBITS_D;
@@ -167,7 +166,7 @@
 union _FP_UNION_D
 {
   DFtype flt;
-  struct {
+  struct _FP_STRUCT_LAYOUT {
 #if __BYTE_ORDER == __BIG_ENDIAN
 unsigned sign   : 1;
 unsigned exp: _FP_EXPBITS_D;
Index: soft-fp/quad.h
===
--- soft-fp/quad.h  (revision 184753)
+++ soft-fp/quad.h  (working copy)
@@ -1,6 +1,6 @@
 /* Software 

Re: [patch testsuite]: Adjust some tests for mingw targets

2012-03-01 Thread Kai Tietz
2012/3/1 Rainer Orth r...@cebitec.uni-bielefeld.de:
 Kai Tietz ktiet...@googlemail.com writes:

 So updated patch (sorry the gmail-mailer breaks lines up here, and I
 can't configure it for not doing so.  So I attached patch, too).

 Ok.  In the future, please indicate on which platforms and how you
 tested the patch.  mingw and x86_64-linux, I assume?

 2012-03-01  Kai Tietz  kti...@redhat.com

       * gcc.dg/torture/pr47917.c: Make test using POSIX-printf
       routines on mingw targets.
       * gcc.dg/vect/pr46126.c (size_t): Add support for

 Please update for the uintptr_t change.

       LLP64 target.

 Ok for apply?

 Ok with that change, provided appropriate testing.

 Thanks.
        Rainer

Of course I tested changes.  I actual did it for i686-w64-mingw32,
x86_64-w64-mingw32, and also for x86_64-unknown-linux-gnu.

Thanks,
Kai


[v3] Update Solaris baselines for GCC 4.7, take 2

2012-03-01 Thread Rainer Orth
After PRs libstdc++/52188 and libstdc++/52189 have been resolved, I'd
finally like to update the Solaris baselines for the 4.7 release.  This
time, everything looks good: only additions to GLIBCXX_3.4.1[67],
CXXABI_1.3.6, and CXXABI_TM_1, as expected.

Bootstrapped without regressions on i386-pc-solaris2.{8, 9, 10, 11} and
sparc-sun-solaris2.{8, 9, 10, 11} with as/ld, gas/ld, and gas/gld.  Also
verified that there are no additions in
$target/libstdc++/testsuite/libstdc++.log.sep.

There are only two FAILs: on Solaris 10 and 11/x86 with as,
_GLOBAL_OFFSET_TABLE_ is missing from the base version.  The jury is
still out whether this is an assembler or linker bug.  I think about
filtering out those symbols bound to the base version (which are
prescribed by the Solaris ABI, but have nothing to do with the
libstdc++.so interface) in a subsequent (4.8) patch, but for now this is
good enough.

Ok for mainline?

Thanks.
Rainer


2012-01-23  Rainer Orth  r...@cebitec.uni-bielefeld.de

* config/abi/post/solaris2.8/baseline_symbols.txt: Regenerate.
* config/abi/post/solaris2.8/sparcv9/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Likewise.
* config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Likewise.

# HG changeset patch
# Parent 87eee9acda6626427d1492875dd3df072da1aac4
Update Solaris baselines for GCC 4.7

diff --git a/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt b/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
--- a/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/solaris2.10/amd64/baseline_symbols.txt
@@ -38,6 +38,10 @@ FUNC:_ZN11__gnu_debug19_Safe_sequence_ba
 FUNC:_ZN11__gnu_debug19_Safe_sequence_base18_M_detach_singularEv@@GLIBCXX_3.4
 FUNC:_ZN11__gnu_debug19_Safe_sequence_base22_M_revalidate_singularEv@@GLIBCXX_3.4
 FUNC:_ZN11__gnu_debug19_Safe_sequence_base7_M_swapERS0_@@GLIBCXX_3.4
+FUNC:_ZN11__gnu_debug25_Safe_local_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb@@GLIBCXX_3.4.17
+FUNC:_ZN11__gnu_debug25_Safe_local_iterator_base9_M_detachEv@@GLIBCXX_3.4.17
+FUNC:_ZN11__gnu_debug30_Safe_unordered_container_base13_M_detach_allEv@@GLIBCXX_3.4.17
+FUNC:_ZN11__gnu_debug30_Safe_unordered_container_base7_M_swapERS0_@@GLIBCXX_3.4.17
 FUNC:_ZN14__gnu_parallel9_Settings3getEv@@GLIBCXX_3.4.10
 FUNC:_ZN14__gnu_parallel9_Settings3setERS0_@@GLIBCXX_3.4.10
 FUNC:_ZN9__gnu_cxx12__atomic_addEPVii@@GLIBCXX_3.4
@@ -720,6 +724,7 @@ FUNC:_ZNSaIwEC2ERKS_@@GLIBCXX_3.4
 FUNC:_ZNSaIwEC2Ev@@GLIBCXX_3.4
 FUNC:_ZNSaIwED1Ev@@GLIBCXX_3.4
 FUNC:_ZNSaIwED2Ev@@GLIBCXX_3.4
+FUNC:_ZNSbIwSt11char_traitsIwESaIwEE10_S_compareEmm@@GLIBCXX_3.4.16
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE12_Alloc_hiderC1EPwRKS1_@@GLIBCXX_3.4
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE12_Alloc_hiderC2EPwRKS1_@@GLIBCXX_3.4
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE12_M_leak_hardEv@@GLIBCXX_3.4
@@ -801,6 +806,7 @@ FUNC:_ZNSbIwSt11char_traitsIwESaIwEE7rep
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE7replaceEmmRKS2_mm@@GLIBCXX_3.4
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE7replaceEmmmw@@GLIBCXX_3.4
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE7reserveEm@@GLIBCXX_3.4
+FUNC:_ZNSbIwSt11char_traitsIwESaIwEE8pop_backEv@@GLIBCXX_3.4.17
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwmw@@GLIBCXX_3.4.5
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE9_M_mutateEmmm@@GLIBCXX_3.4
 FUNC:_ZNSbIwSt11char_traitsIwESaIwEE9push_backEw@@GLIBCXX_3.4
@@ -949,6 +955,7 @@ FUNC:_ZNSolsEs@@GLIBCXX_3.4
 FUNC:_ZNSolsEt@@GLIBCXX_3.4
 FUNC:_ZNSolsEx@@GLIBCXX_3.4
 FUNC:_ZNSolsEy@@GLIBCXX_3.4
+FUNC:_ZNSs10_S_compareEmm@@GLIBCXX_3.4.16
 FUNC:_ZNSs12_Alloc_hiderC1EPcRKSaIcE@@GLIBCXX_3.4
 FUNC:_ZNSs12_Alloc_hiderC2EPcRKSaIcE@@GLIBCXX_3.4
 FUNC:_ZNSs12_M_leak_hardEv@@GLIBCXX_3.4
@@ -1030,6 +1037,7 @@ FUNC:_ZNSs7replaceEmmRKSs@@GLIBCXX_3.4
 FUNC:_ZNSs7replaceEmmRKSsmm@@GLIBCXX_3.4
 FUNC:_ZNSs7replaceEmmmc@@GLIBCXX_3.4
 FUNC:_ZNSs7reserveEm@@GLIBCXX_3.4
+FUNC:_ZNSs8pop_backEv@@GLIBCXX_3.4.17
 FUNC:_ZNSs9_M_assignEPcmc@@GLIBCXX_3.4.5
 FUNC:_ZNSs9_M_mutateEmmm@@GLIBCXX_3.4
 FUNC:_ZNSs9push_backEc@@GLIBCXX_3.4
@@ -1258,6 +1266,9 @@ FUNC:_ZNSt13__future_base12_Result_baseC
 FUNC:_ZNSt13__future_base12_Result_baseD0Ev@@GLIBCXX_3.4.15
 FUNC:_ZNSt13__future_base12_Result_baseD1Ev@@GLIBCXX_3.4.15
 FUNC:_ZNSt13__future_base12_Result_baseD2Ev@@GLIBCXX_3.4.15
+FUNC:_ZNSt13__future_base19_Async_state_commonD0Ev@@GLIBCXX_3.4.17
+FUNC:_ZNSt13__future_base19_Async_state_commonD1Ev@@GLIBCXX_3.4.17
+FUNC:_ZNSt13__future_base19_Async_state_commonD2Ev@@GLIBCXX_3.4.17
 FUNC:_ZNSt13bad_exceptionD0Ev@@GLIBCXX_3.4
 FUNC:_ZNSt13bad_exceptionD1Ev@@GLIBCXX_3.4
 FUNC:_ZNSt13bad_exceptionD2Ev@@GLIBCXX_3.4
@@ -1560,6 +1571,8 @@ FUNC:_ZNSt15__exception_ptreqERKNS_13exc
 FUNC:_ZNSt15__exception_ptrneERKNS_13exception_ptrES2_@@CXXABI_1.3.3
 

Go patch committed: Reliably error on misuse of multi-value call

2012-03-01 Thread Ian Lance Taylor
This patch to the Go compiler reliably gives an error on a misuse of a
function call that returns multiple values.  Previously this could
eventually lead to a compiler crash.  Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r afc75dd8b19a go/types.cc
--- a/go/types.cc	Thu Mar 01 09:21:27 2012 -0800
+++ b/go/types.cc	Thu Mar 01 10:17:10 2012 -0800
@@ -622,16 +622,24 @@
   std::string* reason)
 {
   // Do some checks first.  Make sure the types are defined.
-  if (rhs != NULL
-   rhs-forwarded()-forward_declaration_type() == NULL
-   rhs-is_void_type())
-{
-  if (reason != NULL)
-	*reason = non-value used as value;
-  return false;
-}
-
-  if (lhs != NULL  lhs-forwarded()-forward_declaration_type() == NULL)
+  if (rhs != NULL  !rhs-is_undefined())
+{
+  if (rhs-is_void_type())
+	{
+	  if (reason != NULL)
+	*reason = non-value used as value;
+	  return false;
+	}
+  if (rhs-is_call_multiple_result_type())
+	{
+	  if (reason != NULL)
+	reason-assign(_(multiple value function call in 
+			 single value context));
+	  return false;
+	}
+}
+
+  if (lhs != NULL  !lhs-is_undefined())
 {
   // Any value may be assigned to the blank identifier.
   if (lhs-is_sink_type())
@@ -639,9 +647,7 @@
 
   // All fields of a struct must be exported, or the assignment
   // must be in the same package.
-  if (check_hidden_fields
-	   rhs != NULL
-	   rhs-forwarded()-forward_declaration_type() == NULL)
+  if (check_hidden_fields  rhs != NULL  !rhs-is_undefined())
 	{
 	  if (lhs-has_hidden_fields(NULL, reason)
 	  || rhs-has_hidden_fields(NULL, reason))
@@ -715,9 +721,6 @@
 {
   if (rhs-interface_type() != NULL)
 	reason-assign(_(need explicit conversion));
-  else if (rhs-is_call_multiple_result_type())
-	reason-assign(_(multiple value function call in 
-			 single value context));
   else if (lhs-named_type() != NULL  rhs-named_type() != NULL)
 	{
 	  size_t len = (lhs-named_type()-name().length()


Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Joseph S. Myers
On Thu, 1 Mar 2012, Kai Tietz wrote:

 As I understand the README file in soft-fp, just those files affected
 by my patch need to be merged from glibc.

It's better to import the lot, rather than have mixed versions.  (But if 
there are non-comment changes to files not affected by your patch, it 
might be a good idea to wait until after the 4.7 branch to import those.)

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


Re: [patch testsuite]: Adjust some tests for mingw targets

2012-03-01 Thread Rainer Orth
Kai Tietz ktiet...@googlemail.com writes:

 2012-03-01  Kai Tietz  kti...@redhat.com

       * gcc.dg/torture/pr47917.c: Make test using POSIX-printf
       routines on mingw targets.
       * gcc.dg/vect/pr46126.c (size_t): Add support for

 Please update for the uintptr_t change.

Would you please fix up the ChangeLog as requested?

 Of course I tested changes.  I actual did it for i686-w64-mingw32,
 x86_64-w64-mingw32, and also for x86_64-unknown-linux-gnu.

I never assumed otherwise, but you should state that in your
submissions.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] [SH] Fix target/48596

2012-03-01 Thread Mike Stump
On Feb 29, 2012, at 8:11 PM, Kaz Kojima wrote:
 The attached patch is to avoid PR target/48596 which is a 4.7
 regression on SH.  It seems that now IRA aggressively tried to
 use fp regs as the holder for memory addresses on this port.

Gosh, I hope IRA is cleaned up, as other ports do have weird register 
restrictions...  that don't want to get hit by the new IRA code.  [ crosses 
fingers that when I update to 4.7, I won't hit this ]


[Patch, wwwdocs, committed] index.html: Update 4.6 Status Report link to 4.6.3 announcement

2012-03-01 Thread Tobias Burnus


Index: index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/index.html,v
retrieving revision 1.837
diff -u -r1.837 index.html
--- index.html	1 Mar 2012 14:40:13 -	1.837
+++ index.html	1 Mar 2012 18:41:39 -
@@ -130,7 +130,7 @@
 /dtdd
   Status:
   !--GCC 4.6 status below--
-  a href=http://gcc.gnu.org/ml/gcc/2011-10/msg00486.html;2011-10-27/a
+  a href=http://gcc.gnu.org/ml/gcc/2012-03/msg6.html;2012-03-01/a
   !--GCC 4.6 status above--
   (regression fixes and docs only).
   br /


Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Kai Tietz
2012/3/1 Joseph S. Myers jos...@codesourcery.com:
 On Thu, 1 Mar 2012, Kai Tietz wrote:

 As I understand the README file in soft-fp, just those files affected
 by my patch need to be merged from glibc.

 It's better to import the lot, rather than have mixed versions.  (But if
 there are non-comment changes to files not affected by your patch, it
 might be a good idea to wait until after the 4.7 branch to import those.)

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

Well, there are some new files, which aren't present in gcc's copy.
The rest of the changes are just related to the copyright-comment
section as far as I can see.

So for doing the full update Makefile in libgcc needs to be updated to have
sqrtdf2.c, sqrtsf2.c, and sqrttf2.c in build, too (if we want them).
The latter seems to me some material for 4.8.

So is the partial import for fixing the target issue ok?

Regards,
Kai


[google/4.6]Backport r184061 from upstream 4.6 (issue5712053)

2012-03-01 Thread Jing Yu
Backport r184061 from gcc-4_6 branch to fix an invalid
constant simplification (PR52060).

bootstrap and crosstool tests pass.

OK for google/gcc-4_6 and google/gcc-4_6_2-mobile?


2012-03-01  Jing Yu  jin...@google.com
Backport r184061 from gcc-4_6-branch to fix PR52060.

2012-02-07  Jakub Jelinek  ja...@redhat.com
PR rtl-optimization/52060
* gcc.dg/torture/pr52060.c: New test.

2012-03-01   Jing Yu  jin...@google.com
Backport r184061 from gcc-4_6-branch to fix PR52060.

2012-02-07  Jakub Jelinek  ja...@redhat.com
PR rtl-optimization/52060
* combine.c (try_combine): Add i0src_copy and i0src_copy2 variables,
copy i1src to i1src_copy whenever added_sets_2  i1_feeds_i2_n
already before i1dest - i1src substitution in newpat, copy i0src
to i0src_copy and/or i0src_copy2 when needed.


Index: testsuite/ChangeLog.google-4_6
===
--- testsuite/ChangeLog.google-4_6  (revision 184667)
+++ testsuite/ChangeLog.google-4_6  (working copy)
@@ -1,3 +1,10 @@
+2012-03-01  Jing Yu  jin...@google.com
+   Backport r184061 from gcc-4_6-branch to fix PR52060.
+
+   2012-02-07  Jakub Jelinek  ja...@redhat.com
+   PR rtl-optimization/52060
+   * gcc.dg/torture/pr52060.c: New test.
+
 2012-02-19  Jeffrey Yasskin jyass...@google.com
 Backport r183223 from gcc-4_6-branch to fix a segfault in C++11
mode.
Index: testsuite/gcc.dg/torture/pr52060.c
===
--- testsuite/gcc.dg/torture/pr52060.c  (revision 0)
+++ testsuite/gcc.dg/torture/pr52060.c  (revision 0)
@@ -0,0 +1,57 @@
+/* PR rtl-optimization/52060 */
+/* { dg-do run { target int32plus } } */
+
+extern void abort (void);
+union U { float f; unsigned int i; };
+
+static inline __attribute__((always_inline)) unsigned int
+foo (float x)
+{
+  union U u;
+  unsigned int a, b, c;
+  int d;
+  int e;
+  u.f = x;
+  d = ((unsigned) u.i  23)  0xFF;
+  c = d  126 ? 0 : ~0;
+  e = 127 + 30 - d;
+  a = (u.i  8) | 0x8000U;
+  b = a  ((1  e) - 1);
+  a = a  e;
+  c = (b | (a  2)) ? ~0 : ~1;
+  a = ((a + 1U)  1)  c;
+  return a;
+}
+
+__attribute__((noinline)) unsigned int
+bar (float x)
+{
+  unsigned int a, b, c;
+  static const unsigned int d[128] =
+  {
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 7
+  };
+  a = foo (1048575.0f * x);
+  c = d[a  13];
+  b = (c  13) | ((a  (7 - c))  0x1fff);
+  return b;
+}
+
+int
+main ()
+{
+  union U u;
+  u.f = 1048575.0f;
+  if (sizeof (u.i) == sizeof (u.f)
+   u.i == 0x4970U
+   bar (1.0f) != 65535)
+abort ();
+  return 0;
+}
Index: ChangeLog.google-4_6
===
--- ChangeLog.google-4_6(revision 184667)
+++ ChangeLog.google-4_6(working copy)
@@ -1,3 +1,13 @@
+2012-03-01   Jing Yu  jin...@google.com
+   Backport r184061 from gcc-4_6-branch to fix PR52060.
+
+   2012-02-07  Jakub Jelinek  ja...@redhat.com
+   PR rtl-optimization/52060
+   * combine.c (try_combine): Add i0src_copy and i0src_copy2 variables,
+   copy i1src to i1src_copy whenever added_sets_2  i1_feeds_i2_n
+   already before i1dest - i1src substitution in newpat, copy i0src
+   to i0src_copy and/or i0src_copy2 when needed.
+
 2012-02-21   Jing Yu  jin...@google.com
 
Google Ref 47894
Index: combine.c
===
--- combine.c   (revision 184667)
+++ combine.c   (working copy)
@@ -2551,8 +2551,8 @@
   rtx i3dest_killed = 0;
   /* SET_DEST and SET_SRC of I2, I1 and I0.  */
   rtx i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0;
-  /* Copy of SET_SRC of I1, if needed.  */
-  rtx i1src_copy = 0;
+  /* Copy of SET_SRC of I1 and I0, if needed.  */
+  rtx i1src_copy = 0, i0src_copy = 0, i0src_copy2 = 0;
   /* Set if I2DEST was reused as a scratch register.  */
   bool i2scratch = false;
   /* The PATTERNs of I0, I1, and I2, or a copy of them in certain cases.  */
@@ -3164,6 +3164,11 @@
   n_occurrences = 0;
   subst_low_luid = DF_INSN_LUID (i1);
 
+  /* If the following substitution will modify I1SRC, make a copy of it
+for the case where it is substituted for I1DEST in I2PAT later.  */
+  if (added_sets_2  i1_feeds_i2_n)
+   i1src_copy = copy_rtx (i1src);
+
   /* If I0 feeds into I1 and I0DEST is in I0SRC, we need to make a unique
 copy of I1SRC each time we substitute it, in order to avoid creating
 self-referential RTL when we 

Fix 64-bit *intmax_t definitions on IRIX

2012-03-01 Thread Rainer Orth
The 64-bit gcc.dg/intmax_t-1.c was failing on IRIX 6.5:

FAIL: gcc.dg/intmax_t-1.c (test for excess errors)
Excess errors:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/intmax_t-1.c:19:10: warning: 
assignment from incompatible pointer type [enabled by default]
/vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/intmax_t-1.c:25:11: warning: 
assignment from incompatible pointer type [enabled by default]

There's an inconsistency between iris6.h

#define INTMAX_TYPE long long int
#define UINTMAX_TYPE long long unsigned int

and inttypes.h: it has

typedef __int64_t   intmax_t;
typedef __uint64_t  uintmax_t;

with sgidefs.h:

#if (_MIPS_SZLONG == 64)
typedef long __int64_t;
typedef unsigned long __uint64_t;
#else
#if defined(_LONGLONG)
/*  Its alright to use long long in definitions  */
typedef long long __int64_t;
typedef unsigned long long  __uint64_t;

OTOH, for the C99 case, stdint.h has

typedef signed long longintmax_t;
typedef unsigned long long  uintmax_t;

for both 32 and 64-bit.

Resolving this turned out to be messy: since INTMAX_TYPE is used outside
the C frontent (fortran/iso-c-binding.def), I cannot check flag_isoc99
directly.  Instead, I introduce a tri-state long_intmax variable and set
it in SUBTARGET_OVERRIDE_OPTIONS (always) or C_COMMON_OVERRIDE_OPTIONS
(for C-family languages).  Since C_COMMON_OVERRIDE_OPTIONS is called
after TARGET_OPTION_OVERRIDE, I need to be careful not to undo the
effect of the former.  As an additional complication, I cannot use
LONG_TYPE_SIZE since that (resp. TARGET_LONG64) is only set in
mips_option_override long after after C_COMMON_OVERRIDE_OPTIONS and also
after SUBTARGET_OVERRIDE_OPTIONS.  I'm checking mips_abi instead, which
is set early by the option processing machinery.

With this patch, the three affected testcases

gcc.dg/c99-stdint-5.c
gcc.dg/c99-stdint-6.c
gcc.dg/intmax_t-1.c

all pass for both 32 and 64-bit, and f951 does link.

Since a complete bootstrap/test cycle takes 36 hours, I'll include the
patch in this weekend's bootstrap.  Ok for mainline if that passes?

Thanks.
Rainer


2012-02-22  Rainer Orth  r...@cebitec.uni-bielefeld.de

* config/mips/iris6.h [!USED_FOR_TARGET] (long_intmax): Declare.
(INTMAX_TYPE): Use it.
(UINTMAX_TYPE): Likewise.
(SUBTARGET_OVERRIDE_OPTIONS): Define.
(irix6_c_common_override_options): Declare.
(C_COMMON_OVERRIDE_OPTIONS): Define.
* config/mips/mips.c [TARGET_IRIX6] (long_intmax): Define.
* config/mips/irix6-c.c: New file.
* config/mips/t-irix6 (irix6-c.o): New target.
* config.gcc (mips-sgi-irix6.5): Set c_target_objs,
cxx_target_objs.

# HG changeset patch
# Parent 203f32f0782387e4800848f2fd446b7ce909b384
Fix 64-bit *intmax_t definitions on IRIX

diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1707,6 +1707,8 @@ microblaze*-*-*)
 mips-sgi-irix6.5*)
 	tm_file=elfos.h ${tm_file} mips/iris6.h
 	tmake_file=mips/t-irix6 t-slibgcc
+	c_target_objs=irix6-c.o
+	cxx_target_objs=irix6-c.o
 	extra_options=${extra_options} rpath.opt mips/iris6.opt
 	target_cpu_default=MASK_ABICALLS
 	tm_defines=${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32
diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h
--- a/gcc/config/mips/iris6.h
+++ b/gcc/config/mips/iris6.h
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler.  IRIX 6.5 version.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -121,6 +121,11 @@ extern const char *host_detect_local_cpu
 #undef WINT_TYPE_SIZE
 #define WINT_TYPE_SIZE INT_TYPE_SIZE
 
+#ifndef USED_FOR_TARGET
+/* Use long for intmax_t, uintmax_t?  */
+extern int long_intmax;
+#endif
+
 /* C99 stdint.h types.  */
 #define INT8_TYPE signed char
 #define INT16_TYPE short int
@@ -149,8 +154,8 @@ extern const char *host_detect_local_cpu
 #define UINT_FAST32_TYPE unsigned int
 #define UINT_FAST64_TYPE long long unsigned int
 
-#define INTMAX_TYPE long long int
-#define UINTMAX_TYPE long long unsigned int
+#define INTMAX_TYPE (long_intmax ? long int : long long int)
+#define UINTMAX_TYPE (long_intmax ? long unsigned int : long long unsigned int)
 
 #define INTPTR_TYPE long int
 #define UINTPTR_TYPE long unsigned int
@@ -206,6 +211,20 @@ extern const char *host_detect_local_cpu
 }\
   while (0)
 
+/* SUBTARGET_OVERRIDE_OPTIONS is run after C_COMMON_OVERRIDE_OPTIONS, so
+   only set long_intmax if uninitialized.  */
+#undef SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS 		\
+  do		\
+{		\
+  if (long_intmax == -1)			\
+	long_intmax = mips_abi == ABI_64;	\
+}		\
+  while (0)
+
+extern void irix6_c_common_override_options 

Re: C++ PATCH to warn about ignored attributes

2012-03-01 Thread Jason Merrill

On 02/14/2012 08:50 PM, Jason Merrill wrote:

While looking at PR 51930, I discovered that we were silently ignoring
attributes on explicit instantiations; this patch warns about this. This
isn't exactly a regression, but the submitter ran into it as a result of
a behavior change in 4.7, and the patch is extremely safe, so I think it
should go in.


It turns out that we already had a warning for this situation that also 
gives a suggestion for how to deal with it, so I'm going to make that 
warning apply to this case as well.


Tested x86_64-pc-linux-gnu, applying to trunk.


commit fc93bb109ba5d22a5c08ee026d572436a999bdef
Author: Jason Merrill ja...@redhat.com
Date:   Wed Feb 29 21:51:33 2012 -0500

	PR c++/51930
	* decl.c (check_tag_decl): Move warning for misplaced attributes here.
	(shadow_tag): From here.
	* parser.c (cp_parser_explicit_instantiation): Don't warn here.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2a6a516..c47f87c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4216,6 +4216,19 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
 error (%constexpr% cannot be used for type declarations);
 }
 
+  if (declspecs-attributes)
+{
+  location_t loc = input_location;
+  if (!CLASSTYPE_TEMPLATE_INSTANTIATION (declared_type))
+	/* For a non-template class, use the name location; for a template
+	   class (an explicit instantiation), use the current location.  */
+	input_location = location_of (declared_type);
+  warning (0, attribute ignored in declaration of %q#T, declared_type);
+  warning (0, attribute for %q#T must follow the %qs keyword,
+	   declared_type, class_key_or_enum_as_string (declared_type));
+  input_location = loc;
+}
+
   return declared_type;
 }
 
@@ -4240,14 +4253,6 @@ shadow_tag (cp_decl_specifier_seq *declspecs)
   if (!t)
 return NULL_TREE;
 
-  if (declspecs-attributes)
-{
-  warning (0, attribute ignored in declaration of %q+#T, t);
-  warning (0, attribute for %q+#T must follow the %qs keyword,
-	   t, class_key_or_enum_as_string (t));
-
-}
-
   if (maybe_process_partial_specialization (t) == error_mark_node)
 return NULL_TREE;
 
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 3e2be97..491f48e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -13122,9 +13122,6 @@ cp_parser_explicit_instantiation (cp_parser* parser)
   tree type;
 
   type = check_tag_decl (decl_specifiers);
-  if (decl_specifiers.attributes)
-	warning (OPT_Wattributes,
-		 attributes ignored on explicit type instantiation);
   /* Turn access control back on for names used during
 	 template instantiation.  */
   pop_deferring_access_checks ();
diff --git a/gcc/testsuite/g++.dg/ext/attrib43.C b/gcc/testsuite/g++.dg/ext/attrib43.C
index fe9f072..acae3f2 100644
--- a/gcc/testsuite/g++.dg/ext/attrib43.C
+++ b/gcc/testsuite/g++.dg/ext/attrib43.C
@@ -2,4 +2,4 @@ template class T struct A { };
 
 template
 __attribute__ ((packed))
-struct Aint;			// { dg-warning attributes ignored }
+struct Aint;			// { dg-warning attribute }



[SH] Add support for tas.b instruction

2012-03-01 Thread Oleg Endo
Hello,

The attached patch adds support for the SH tas.b instruction by
introducing a new target option -menable-tas.
The patch was tested against rev 184589 with...

make info dvi pdf

make -k check RUNTESTFLAGS=--target_board=sh-sim\{
-m2/-ml,-m2/-mb, -m2a-single/-mb,
-m4-single/-ml,-m4-single/-mb,
-m4a-single/-ml,-m4a-single/-mb}

make -k check RUNTESTFLAGS=--target_board=sh-sim\{
-m2/-ml/-msoft-atomic,-m2/-mb/-msoft-atomic,
-m2a-single/-mb/-msoft-atomic,
-m4-single/-ml/-msoft-atomic,-m4-single/-mb/-msoft-atomic,
-m4a-single/-ml/-msoft-atomic,-m4a-single/-mb/-msoft-atomic}

make -k check RUNTESTFLAGS=--target_board=sh-sim\{
-m2/-ml/-msoft-atomic/-menable-tas,-m2/-mb/-msoft-atomic/-menable-tas,
-m2a-single/-mb/-msoft-atomic/-menable-tas,
-m4-single/-ml/-msoft-atomic/-menable-tas,
-m4-single/-mb/-msoft-atomic/-menable-tas,
-m4a-single/-ml/-msoft-atomic/-menable-tas,
-m4a-single/-mb/-msoft-atomic/-menable-tas}

make -k check RUNTESTFLAGS=--target_board=sh-sim\{
-m2/-ml/-menable-tas,-m2/-mb/-menable-tas,
-m2a-single/-mb/-menable-tas,
-m4-single/-ml/-menable-tas,-m4-single/-mb/-menable-tas,
-m4a-single/-ml/-menable-tas,-m4a-single/-mb/-menable-tas}

... and no new failures, except for the last test run which does not
enable any atomics.  There it fails the test case gcc.dg/atomic-flag.c.

This is because TARGET_ATOMIC_TEST_AND_SET_TRUEVAL is defined to 0x80,
but the code in optabs.c (expand_atomic_test_and_set) always uses
const1_rtx as the atomic flag true-value when expanding single thread
fake atomics.  However, the failing test case checks the written atomic
flag value against __GCC_ATOMIC_TEST_AND_SET_TRUEVAL, which is defined
in the SH target to 0x80.

One way to fix this problem is the example patch in my previous message
regarding this issue:
http://gcc.gnu.org/ml/gcc-patches/2012-02/msg01408.html

Another way would be to allow the TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
hook to be evaluated (conditionally) at runtime.  Then for example, the
target could set it to 0x80 if atomics are enabled by the user, or leave
it at 0x01 if they aren't.

Other than that, OK for 4.8?

Cheers,
Oleg

2012-03-01  Oleg Endo  olege...@gcc.gnu.org

* config/sh/sh.h (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): New hook.
* config/sh/sync.md (atomic_test_and_set): New expander.
(tasb, atomic_test_and_set_soft): New insns.
* config/sh/sh.opt (menable-tas): New option.
* doc/invoke.texi (SH Options): Document it.


Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi	(revision 184669)
+++ gcc/doc/invoke.texi	(working copy)
@@ -887,7 +887,8 @@
 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
 -maccumulate-outgoing-args -minvalid-symbols -msoft-atomic @gol
--mbranch-cost=@var{num} -mcbranchdi -mcmpeqdi -mfused-madd -mpretend-cmove}
+-mbranch-cost=@var{num} -mcbranchdi -mcmpeqdi -mfused-madd -mpretend-cmove @gol
+-menable-tas}
 
 @emph{Solaris 2 Options}
 @gccoptlist{-mimpure-text  -mno-impure-text @gol
@@ -17829,6 +17830,15 @@
 This option is enabled by default when the target is @code{sh-*-linux*}.
 For details on the atomic built-in functions see @ref{__atomic Builtins}.
 
+@item -menable-tas
+@opindex menable-tas
+Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
+Notice that depending on the particular hardware and software configuration
+this can degrade overall performance due to the operand cache line flushes
+that are implied by the @code{tas.b} instruction.  On multi-core SH4A
+processors the @code{tas.b} instruction must be used with caution since it
+can result in data corruption for certain cache configurations.
+
 @item -mspace
 @opindex mspace
 Optimize for space instead of speed.  Implied by @option{-Os}.
Index: gcc/config/sh/sh.h
===
--- gcc/config/sh/sh.h	(revision 184669)
+++ gcc/config/sh/sh.h	(working copy)
@@ -2475,4 +2475,11 @@
 /* FIXME: middle-end support for highpart optimizations is missing.  */
 #define high_life_started reload_in_progress
 
+/* The tas.b instruction sets the 7th bit in the byte, i.e. 0x80.
+   This value is used by optabs.c atomic op expansion code as well as in 
+   sync.md.  It must be defined as signed char here or else the movqi
+   pattern will refuse to load it as a QImode constant.  */
+#undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
+#define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ((signed char)0x80)
+
 #endif /* ! GCC_SH_H */
Index: gcc/config/sh/sync.md
===
--- gcc/config/sh/sync.md	(revision 184669)
+++ gcc/config/sh/sync.md	(working copy)
@@ -365,3 +365,60 @@
 	 1:	mov	r1,r15;
 }
   [(set_attr length 18)])
+
+(define_expand atomic_test_and_set
+  [(match_operand:SI 0 register_operand )		;; bool result output
+   (match_operand:QI 1 

[google/4.6]Backport r184370 from integration (issue5716054)

2012-03-01 Thread Doug Kwan
Hi Diego,

   This is a backport of r184370 from integration branch.  I have tested this
by building it for different configurations of powerpc.

-Doug

2012-03-01   Doug Kwan  dougk...@google.com

Backport r184370 from integration branch.

2012-02-17   Doug Kwan  dougk...@google.com

* gcc/config.gcc (powerpc*-*-linux): Pull in GRTEv2 spec
changes if target matches *-grtev2-*.
* gcc/config/rs6000/linux64.h (GLIB_DYNAMIC_LINKER{32,64}): Add
runtime root prefix to glibc's dynamic linker.
* gcc/config/rs6000/linux-grtev2.h: New file.
* gcc/config/rs6000/sysv4.h (GLIB_DYNAMIC_LINKER): Add
runtime root prefix to glibc's dynamic linker.
(LINUX_GRTE_EXTRA_SPECS): Define to be empty if no definition
found.
(SUBTARGET_EXTRA_SPECS): Include LINUX_GRTE_EXTRA_SPECS.

Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 184683)
+++ gcc/config.gcc  (working copy)
@@ -2198,6 +2198,12 @@ powerpc-*-linux* | powerpc64-*-linux*)
if test x${enable_secureplt} = xyes; then
tm_file=rs6000/secureplt.h ${tm_file}
fi
+   # Pull in spec changes for GRTEv2 configurations.
+   case ${target} in
+   *-grtev2-*)
+   tm_file=${tm_file} rs6000/linux-grtev2.h
+   ;;
+   esac
;;
 powerpc64-*-gnu*)
tm_file=${tm_file} elfos.h freebsd-spec.h gnu.h rs6000/sysv4.h 
rs6000/default64.h rs6000/linux64.h rs6000/gnu.h glibc-stdint.h
Index: gcc/config/rs6000/linux64.h
===
--- gcc/config/rs6000/linux64.h (revision 184683)
+++ gcc/config/rs6000/linux64.h (working copy)
@@ -372,8 +372,8 @@ extern int dot_symbols;
 #undef LINK_OS_DEFAULT_SPEC
 #define LINK_OS_DEFAULT_SPEC %(link_os_linux)
 
-#define GLIBC_DYNAMIC_LINKER32 /lib/ld.so.1
-#define GLIBC_DYNAMIC_LINKER64 /lib64/ld64.so.1
+#define GLIBC_DYNAMIC_LINKER32 RUNTIME_ROOT_PREFIX /lib/ld.so.1
+#define GLIBC_DYNAMIC_LINKER64 RUNTIME_ROOT_PREFIX /lib64/ld64.so.1
 #define UCLIBC_DYNAMIC_LINKER32 /lib/ld-uClibc.so.0
 #define UCLIBC_DYNAMIC_LINKER64 /lib/ld64-uClibc.so.0
 #if DEFAULT_LIBC == LIBC_UCLIBC
Index: gcc/config/rs6000/linux-grtev2.h
===
--- gcc/config/rs6000/linux-grtev2.h(revision 0)
+++ gcc/config/rs6000/linux-grtev2.h(revision 0)
@@ -0,0 +1,43 @@
+/* Definitions for Linux-based GRTE (Google RunTime Environment) version 2.
+   Copyright (C) 2009,2010,2011,2012 Free Software Foundation, Inc.
+   Contributed by Chris Demetriou and Ollie Wild.
+
+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 WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+http://www.gnu.org/licenses/.  */
+
+/* Overrides LIB_LINUX_SPEC from sysv4.h.  */
+#undef LIB_LINUX_SPEC
+#define LIB_LINUX_SPEC \
+  %{pthread:-lpthread} \
+   %{shared:-lc} \
+   %{!shared:%{mieee-fp:-lieee} %{profile:%(libc_p)}%{!profile:%(libc)}}
+
+/* When GRTE links statically, it needs its NSS and resolver libraries
+   linked in as well.  Note that when linking statically, these are
+   enclosed in a group by LINK_GCC_C_SEQUENCE_SPEC.  */
+#undef LINUX_GRTE_EXTRA_SPECS
+#define LINUX_GRTE_EXTRA_SPECS \
+  { libc, %{static:%(libc_static);:-lc} }, \
+  { libc_p, %{static:%(libc_p_static);:-lc_p} }, \
+  { libc_static, \
+-lc -lnss_borg -lnss_cache -lnss_dns -lnss_files -lresolv }, \
+  { libc_p_static, \
+-lc_p -lnss_borg_p -lnss_cache_p -lnss_dns_p -lnss_files_p -lresolv_p },
Index: gcc/config/rs6000/sysv4.h
===
--- gcc/config/rs6000/sysv4.h   (revision 184683)
+++ gcc/config/rs6000/sysv4.h   (working copy)
@@ -818,7 +818,10 @@ extern int fixuplabelno;
 
 #define LINK_START_LINUX_SPEC 
 
-#define GLIBC_DYNAMIC_LINKER /lib/ld.so.1
+#ifndef RUNTIME_ROOT_PREFIX
+#define RUNTIME_ROOT_PREFIX 
+#endif
+#define GLIBC_DYNAMIC_LINKER RUNTIME_ROOT_PREFIX /lib/ld.so.1
 #define UCLIBC_DYNAMIC_LINKER /lib/ld-uClibc.so.0
 #if DEFAULT_LIBC == LIBC_UCLIBC
 #define 

[committed] Fix PR target/52408 -- wrong code for left shift

2012-03-01 Thread John David Anglin
This patch fixes a target problem found with the Linux ext4 driver.

The zvdep_imm64 pattern truncated the 64-bit constant operand to 32-bits.
The truncated value was -1.  As a result, (x  4) + 1 was zero,
the call to exact_log2 failed, and thus the insert length for the constant
was wrong.  This is fixed by changing x to a unsigned HOST_WIDE_INT.

The other fixes are similar.

Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.  Committed
to trunk.

Dave
-- 
J. David Anglin  dave.ang...@nrc-cnrc.gc.ca
National Research Council of Canada  (613) 990-0752 (FAX: 952-6602)

2012-03-01  John David Anglin  dave.ang...@nrc-cnrc.gc.ca

PR target/52408
* config/pa/pa.md (zvdep_imm32): Change type of variable x from int to
unsigned HOST_WIDE_INT.
(zvdep_imm64): Likewise.
(vdepi_ior): Change type of variable x from int to HOST_WIDE_INT.
(vdepi_and): Likewise.
Likewise for unamed 64-bit patterns.
* config/pa/predicates.md (lhs_lshift_cint_operand): Update comment.

Index: config/pa/pa.md
===
--- config/pa/pa.md (revision 184661)
+++ config/pa/pa.md (working copy)
@@ -6349,7 +6349,7 @@
   
   *
 {
-  int x = INTVAL (operands[1]);
+  unsigned HOST_WIDE_INT x = UINTVAL (operands[1]);
   operands[2] = GEN_INT (4 + exact_log2 ((x  4) + 1));
   operands[1] = GEN_INT ((x  0xf) - 0x10);
   return \{zvdepi %1,%2,%0|depwi,z %1,%%sar,%2,%0}\;
@@ -6367,7 +6367,7 @@
   exact_log2 (INTVAL (operands[1]) + 1)  0
   *
 {
-  int x = INTVAL (operands[1]);
+  HOST_WIDE_INT x = INTVAL (operands[1]);
   operands[2] = GEN_INT (exact_log2 (x + 1));
   return \{vdepi -1,%2,%0|depwi -1,%%sar,%2,%0}\;
 }
@@ -6384,7 +6384,7 @@
   INTVAL (operands[1]) == -2
   *
 {
-  int x = INTVAL (operands[1]);
+  HOST_WIDE_INT x = INTVAL (operands[1]);
   operands[2] = GEN_INT (exact_log2 ((~x) + 1));
   return \{vdepi 0,%2,%0|depwi 0,%%sar,%2,%0}\;
 }
@@ -6448,7 +6448,7 @@
   TARGET_64BIT
   *
 {
-  int x = INTVAL (operands[1]);
+  unsigned HOST_WIDE_INT x = UINTVAL (operands[1]);
   operands[2] = GEN_INT (4 + exact_log2 ((x  4) + 1));
   operands[1] = GEN_INT ((x  0x1f) - 0x20);
   return \depdi,z %1,%%sar,%2,%0\;
@@ -6466,7 +6466,7 @@
   TARGET_64BIT  exact_log2 (INTVAL (operands[1]) + 1)  0
   *
 {
-  int x = INTVAL (operands[1]);
+  HOST_WIDE_INT x = INTVAL (operands[1]);
   operands[2] = GEN_INT (exact_log2 (x + 1));
   return \depdi -1,%%sar,%2,%0\;
 }
@@ -6483,7 +6483,7 @@
   TARGET_64BIT  INTVAL (operands[1]) == -2
   *
 {
-  int x = INTVAL (operands[1]);
+  HOST_WIDE_INT x = INTVAL (operands[1]);
   operands[2] = GEN_INT (exact_log2 ((~x) + 1));
   return \depdi 0,%%sar,%2,%0\;
 }
Index: config/pa/predicates.md
===
--- config/pa/predicates.md (revision 184661)
+++ config/pa/predicates.md (working copy)
@@ -247,9 +247,9 @@
   (ior (match_operand 0 ireg_operand)
(match_operand 0 int5_operand)))
 
-;; True iff OP is a CONST_INT of the forms 0...0 or
-;; 0...01...1. Such values can be the left hand side x in (x 
-;; r), using the zvdepi instruction.
+;; True iff OP is a CONST_INT of the forms 0...0, 0...01...1,
+;; or 1...1. Such values can be the left hand side x in (x  r),
+;; using the zvdepi instruction.
 
 (define_predicate lhs_lshift_cint_operand
   (match_code const_int)


[SH] Remove dead tertiary_reload_operand function

2012-03-01 Thread Oleg Endo
Hello,

The function tertiary_reload_operand in sh.c seems to be dead code.  The
attached patch deletes it.

Tested with: make all-gcc

OK to apply?

Cheers,
Oleg

2012-03-01  Oleg Endo  olege...@gcc.gnu.org

* config/sh/sh-protos.h (tertiary_reload_operand): Remove dead
function.
* config/sh/sh.c (tertiary_reload_operand): Likewise.

Index: gcc/config/sh/sh-protos.h
===
--- gcc/config/sh/sh-protos.h	(revision 184757)
+++ gcc/config/sh/sh-protos.h	(working copy)
@@ -104,7 +104,6 @@
 extern int arith_operand (rtx, enum machine_mode);
 extern int arith_reg_or_0_operand (rtx, enum machine_mode);
 extern int logical_operand (rtx, enum machine_mode);
-extern int tertiary_reload_operand (rtx, enum machine_mode);
 extern int fpscr_operand (rtx, enum machine_mode);
 extern int fpul_operand (rtx, enum machine_mode);
 extern int commutative_float_operator (rtx, enum machine_mode);
Index: gcc/config/sh/sh.c
===
--- gcc/config/sh/sh.c	(revision 184757)
+++ gcc/config/sh/sh.c	(working copy)
@@ -9201,13 +9201,6 @@
   return 1;
 }
 
-int
-tertiary_reload_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
-{
-  enum rtx_code code = GET_CODE (op);
-  return code == MEM || (TARGET_SH4  code == CONST_DOUBLE);
-}
-
 /* Return the TLS type for TLS symbols, 0 for otherwise.  */
 enum tls_model
 tls_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)


Re: [google/4.6]Backport r184370 from integration (issue5716054)

2012-03-01 Thread Diego Novillo

On 01/03/12 14:35 , Doug Kwan wrote:


2012-03-01   Doug Kwandougk...@google.com

Backport r184370 from integration branch.

2012-02-17   Doug Kwandougk...@google.com

* gcc/config.gcc (powerpc*-*-linux): Pull in GRTEv2 spec
changes if target matches *-grtev2-*.
* gcc/config/rs6000/linux64.h (GLIB_DYNAMIC_LINKER{32,64}): Add
runtime root prefix to glibc's dynamic linker.
* gcc/config/rs6000/linux-grtev2.h: New file.
* gcc/config/rs6000/sysv4.h (GLIB_DYNAMIC_LINKER): Add
runtime root prefix to glibc's dynamic linker.
(LINUX_GRTE_EXTRA_SPECS): Define to be empty if no definition
found.
(SUBTARGET_EXTRA_SPECS): Include LINUX_GRTE_EXTRA_SPECS.


This is fine, though I'm wondering if you could possibly wait to apply 
it.  I'm currently testing a merge from gcc-4_6-branch to pick up the 
4.6.3 release.


If you need it now, then apply it and let me know so I can re-start my 
testing.



Thanks.  Diego.


Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Joseph S. Myers
On Thu, 1 Mar 2012, Kai Tietz wrote:

 Well, there are some new files, which aren't present in gcc's copy.

They are not new files.  They are files that were in soft-fp all along but 
weren't imported into GCC because they aren't relevant to GCC.

 The rest of the changes are just related to the copyright-comment
 section as far as I can see.

So you should import the current versions of all the files that exist in 
both places (without doing anything about files that only exist in one of 
the two places).

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


Fix POINTER_PLUS_EXPR oversight

2012-03-01 Thread Bernd Schmidt
In pointer_diff we still expect pointer addition to use PLUS_EXPR. I
discovered this while working on a new port with somewhat unusual
pointer types.

Interestingly, the C++ frontend also has a pointer_diff function, but
doesn't seem to attempt to optimize. Is there a reason for this?

Bootstrapped and tested on i686-linux. Ok for now or stage1?


Bernd
* c-typeck.c (pointer_diff): Check for POINTER_PLUS_EXPR, not
PLUS_EXPR.

Index: gcc/c-typeck.c
===
--- gcc/c-typeck.c  (revision 183969)
+++ gcc/c-typeck.c  (working copy)
@@ -3447,7 +3447,9 @@ pointer_diff (location_t loc, tree op0,
   else
 con1 = op1;
 
-  if (TREE_CODE (con0) == PLUS_EXPR)
+  gcc_assert (TREE_CODE (con0) != PLUS_EXPR
+  TREE_CODE (con1) != PLUS_EXPR);
+  if (TREE_CODE (con0) == POINTER_PLUS_EXPR)
 {
   lit0 = TREE_OPERAND (con0, 1);
   con0 = TREE_OPERAND (con0, 0);
@@ -3455,7 +3457,7 @@ pointer_diff (location_t loc, tree op0,
   else
 lit0 = integer_zero_node;
 
-  if (TREE_CODE (con1) == PLUS_EXPR)
+  if (TREE_CODE (con1) == POINTER_PLUS_EXPR)
 {
   lit1 = TREE_OPERAND (con1, 1);
   con1 = TREE_OPERAND (con1, 0);


Re: Fix POINTER_PLUS_EXPR oversight

2012-03-01 Thread Joseph S. Myers
On Thu, 1 Mar 2012, Bernd Schmidt wrote:

 In pointer_diff we still expect pointer addition to use PLUS_EXPR. I
 discovered this while working on a new port with somewhat unusual
 pointer types.
 
 Interestingly, the C++ frontend also has a pointer_diff function, but
 doesn't seem to attempt to optimize. Is there a reason for this?
 
 Bootstrapped and tested on i686-linux. Ok for now or stage1?

OK for stage 1.

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


Re: [RFC, PATCH] ARM related deprecations

2012-03-01 Thread Joseph S. Myers
On Tue, 28 Feb 2012, Richard Earnshaw wrote:

 Here's an updated version, plus some updates to install.texi to avoid
 references to the obsolete ports.
 
 OK?

OK.

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


Re: [Patch 2 wwwdocs] gcc-4.7/changes.html : Document AMD bdver2

2012-03-01 Thread Gerald Pfeifer
On Thu, 1 Mar 2012, Kumar, Venkataramanan wrote:
 This patch adds bdver2 description in changes.html.

Sure, looks good.

Gerald


Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Joseph S. Myers
On Thu, 1 Mar 2012, Kai Tietz wrote:

 2012-03-01  Kai Tietz  kti...@redhat.com
 
   * soft-fp: Imported from glibc upstream.
 
 Ok for apply ?

If this is just copying the files from glibc, then it's OK for GCC.

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


Re: [so_7-2] DR 13631 patch

2012-03-01 Thread François Dumont

Here is what I have finally commited to libstdcxx_so_7-2 branch.

2012-03-01  François Dumont fdum...@gcc.gnu.org

DR libstdc++/13631
* config/locale/gnu/messages_member.h, messages_member.cc: Prefer
dgettext usage to gettext to allow usage of several catalogs at the
same time. Add an internal cache to map catalog names to 
catalog ids.

* testsuite/22_locale/messages/13631.cc: New.

I have integrated your remarks Paolo and also:
- Add a destructor to the Catalogs class, an application that correctly 
close its catalogs will make this destructor useless but it is normal to 
have one.
- I change the _MapEntry from paircatalog, string to paircatalog, 
const char*. This way _M_get do not have a string copy anymore.


Tested under linux x86_64.

François

On 02/29/2012 12:02 PM, Paolo Carlini wrote:

Hi,

Hi

I finally spend some more time to enhance this patch.

I used a sorted array to store the mapping, doing so I do not 
need to export the _Rb_Tree instantiation anymore. I also simplified 
the test, to reproduce the 13631 we don't need an other valid 
catalog, any attempt to open a catalog after having open the 
'libstdc++' one show the issue. So we do not need add any 
dg-require-XXX macro to validate a catalog presence.


If no one see any problem with this patch I will commit it to 
libstdcxx_so_7-2 branch.
I'm Ok with the patch, besides a few minor stylistic nits below. You 
didn't post the ChangeLog entry: remember to have the PR number in it.

Index: testsuite/22_locale/messages/13631.cc
===
--- testsuite/22_locale/messages/13631.cc   (revision 0)
+++ testsuite/22_locale/messages/13631.cc   (revision 0)
@@ -0,0 +1,57 @@
+// { dg-require-namedlocale fr_FR }
+
+// Copyright (C) 2012 Free Software Foundation
+//
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+//http://www.gnu.org/licenses/.
+
+#includelocale
+#includetestsuite_hooks.h
+
+int main(int argc, char **argv)
+{
+  bool test __attribute__((unused)) = true;
+  // This is defined through CXXFLAGS in scripts/testsuite_flags[.in].
+  const char* dir = LOCALEDIR;
+
+  std::locale l(fr_FR);
+
+  typedef std::messageschar  messages;
+
+  const messagesmsgs_facet = std::use_facetmessages(l);
+
+  messages::catalog msgs = msgs_facet.open(libstdc++, l, dir);
+  VERIFY( msgs= 0 );
+
+  const char msgid[] = please;
+  std::string translation1 = msgs_facet.get(msgs, 0, 0, msgid);
+
+  // Without a real translation this test doesn't mean anything:
+  VERIFY( translation1 != msgid );
+
+  // Opening an other catalog was enough to show the problem, even a fake
+  // catalog.
+  messages::catalog fake_msgs = msgs_facet.open(fake, l);
+
+  std::string translation2 = msgs_facet.get(msgs, 0, 0, msgid);
+
+  // Close catalogs before doing the check to avoid leaks.
+  msgs_facet.close(fake_msgs);
+  msgs_facet.close(msgs);
+
+  VERIFY( translation1 == translation2 );
+
+  return 0;
+}

Normally we have the test proper in a separate funtion called from main.

Index: config/locale/gnu/messages_members.cc
===
--- config/locale/gnu/messages_members.cc   (revision 184372)
+++ config/locale/gnu/messages_members.cc   (working copy)
@@ -1,6 +1,7 @@
  // std::messages implementation details, GNU version -*- C++ -*-

-// Copyright (C) 2001, 2002, 2005, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2005, 2009, 2010, 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
@@ -31,54 +32,180 @@
  #includelocale
  #includebits/c++locale_internal.h

+#includealgorithm
+#includeutility
+#includeext/concurrence.h
+
+namespace
+{
+  using namespace std;
+
+  struct Comp
+  {
+typedef messages_base::catalog catalog;
+typedef paircatalog, string  _Mapping;
+
+bool operator () (catalog __cat, const _Mapping* __pair) const
+{ return __cat  __pair-first; }

No space after operator


+
+bool operator () (const _Mapping* __pair, catalog __cat) const
+{ return __pair-first  __cat; }

Likewise.


+  };
+
+  class Catalogs
+  {
+typedef messages_base::catalog catalog;
+typedef paircatalog, string 

[google]Support for getting CPU type and feature information at run-time (issue5715051)

2012-03-01 Thread Sriraman Tallam
Patch to add builtins to detect CPU type:


I have ported the patch from google/gcc-4_6 to google/main.  I also want this
patch to be considered for trunk.  Please see this discussion:
http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01355.html
when this patch for reviewed the last time.

One of the main concerns was about making CPU detection initialization a
constructor. The main point raised was about constructor ordering. I have now
added a priority value to the CPU detection constructor to make it very high
priority so that it is guaranteed to fire before every constructor without
an explicitly marked priority value of 101.  However, IFUNC initializers
will still fire before this constructor, so the cpu initialization routine
has to be explicitly called in such initializers for which I have added a
builtin: __builtin_cpu_init (). 

I would like to reopen discussions on this to make it suitable for trunk
this time around. 

This patch adds the following new builtins:

__builtin_cpu_init
__builtin_cpu_supports_cmov
__builtin_cpu_supports_mmx
__builtin_cpu_supports_popcount
__builtin_cpu_supports_sse
__builtin_cpu_supports_sse2
__builtin_cpu_supports_sse3
__builtin_cpu_supports_ssse3
__builtin_cpu_supports_sse4_1
__builtin_cpu_supports_sse4_2
__builtin_cpu_is_amd
__builtin_cpu_is_intel_atom
__builtin_cpu_is_intel_core2
__builtin_cpu_is_intel
__builtin_cpu_is_intel_corei7
__builtin_cpu_is_intel_corei7_nehalem
__builtin_cpu_is_intel_corei7_westmere
__builtin_cpu_is_intel_corei7_sandybridge
__builtin_cpu_is_amdfam10
__builtin_cpu_is_amdfam10_barcelona
__builtin_cpu_is_amdfam10_shanghai
__builtin_cpu_is_amdfam10_istanbul
__builtin_cpu_is_amdfam15_bdver1
__builtin_cpu_is_amdfam15_bdver2


* config/i386/i386.c (build_struct_with_one_bit_fields): New function.
(make_var_decl): New function.
(get_field_from_struct): New function.
(fold_builtin_target): New function.
(ix86_fold_builtin): New function.
(ix86_expand_builtin): Expand new builtins by folding them.
(make_platform_builtin): New functions.
(ix86_init_platform_type_builtins): Make the new builtins.
(ix86_init_builtins): Make new builtins to detect CPU type.
(TARGET_FOLD_BUILTIN): New macro.
(IX86_BUILTIN_CPU_SUPPORTS_CMOV): New enum value.
(IX86_BUILTIN_CPU_SUPPORTS_MMX): New enum value.
(IX86_BUILTIN_CPU_SUPPORTS_POPCOUNT): New enum value.
(IX86_BUILTIN_CPU_SUPPORTS_SSE): New enum value.
(IX86_BUILTIN_CPU_SUPPORTS_SSE2): New enum value.
(IX86_BUILTIN_CPU_SUPPORTS_SSE3): New enum value.
(IX86_BUILTIN_CPU_SUPPORTS_SSSE3): New enum value.
(IX86_BUILTIN_CPU_SUPPORTS_SSE4_1): New enum value.
(IX86_BUILTIN_CPU_SUPPORTS_SSE4_2): New enum value.
(IX86_BUILTIN_CPU_INIT): New enum value.
(IX86_BUILTIN_CPU_IS_AMD): New enum value.
(IX86_BUILTIN_CPU_IS_INTEL): New enum value.
(IX86_BUILTIN_CPU_IS_INTEL_ATOM): New enum value.
(IX86_BUILTIN_CPU_IS_INTEL_CORE2): New enum value.
(IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM): New enum value.
(IX86_BUILTIN_CPU_IS_INTEL_COREI7_WESTMERE): New enum value.
(IX86_BUILTIN_CPU_IS_INTEL_COREI7_SANDYBRIDGE): New enum value.
(IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA): New enum value.
(IX86_BUILTIN_CPU_IS_AMDFAM10_SHANGHAI): New enum value.
(IX86_BUILTIN_CPU_IS_AMDFAM10_ISTANBUL): New enum value.
(IX86_BUILTIN_CPU_IS_AMDFAM15H_BDVER1): New enum value.
(IX86_BUILTIN_CPU_IS_AMDFAM15H_BDVER2): New enum value.
* config/i386/i386-builtin-types.def: New function type.
* testsuite/gcc.target/builtin_target.c: New testcase.

* libgcc/config/i386/i386-cpuinfo.c: New file.
* libgcc/config/i386/t-cpuinfo: New file.
* libgcc/config.host: Include t-cpuinfo.
* libgcc/config/i386/libgcc-glibc.ver: Version symbols __cpu_model
and __cpu_features.



Index: libgcc/config.host
===
--- libgcc/config.host  (revision 184644)
+++ libgcc/config.host  (working copy)
@@ -1128,7 +1128,7 @@ i[34567]86-*-linux* | x86_64-*-linux* | \
   i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
   i[34567]86-*-knetbsd*-gnu | \
   i[34567]86-*-gnu*)
-   tmake_file=${tmake_file} t-tls i386/t-linux
+   tmake_file=${tmake_file} t-tls i386/t-linux i386/t-cpuinfo
if test $libgcc_cv_cfi = yes; then
tmake_file=${tmake_file} t-stack i386/t-stack-i386
fi
Index: libgcc/config/i386/t-cpuinfo
===
--- libgcc/config/i386/t-cpuinfo(revision 0)
+++ libgcc/config/i386/t-cpuinfo(revision 0)
@@ -0,0 +1 @@
+LIB2ADD += $(srcdir)/config/i386/i386-cpuinfo.c
Index: libgcc/config/i386/i386-cpuinfo.c
===
--- 

Re: [patch libgcc]: Fix float128 soft-float for mingw targets

2012-03-01 Thread Kai Tietz
2012/3/1 Joseph S. Myers jos...@codesourcery.com:
 On Thu, 1 Mar 2012, Kai Tietz wrote:

 2012-03-01  Kai Tietz  kti...@redhat.com

       * soft-fp: Imported from glibc upstream.

 Ok for apply ?

 If this is just copying the files from glibc, then it's OK for GCC.

Yes, it is. Applied at rev 184760.

Thanks,
Kai


Re: [google]Support for getting CPU type and feature information at run-time (issue5715051)

2012-03-01 Thread Xinliang David Li
Sri, probably need to remove the [google] prefix in the subject line
to prevent this from being filtered.

David

On Thu, Mar 1, 2012 at 12:45 PM, Sriraman Tallam tmsri...@google.com wrote:
 Patch to add builtins to detect CPU type:
 

 I have ported the patch from google/gcc-4_6 to google/main.  I also want this
 patch to be considered for trunk.  Please see this discussion:
 http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01355.html
 when this patch for reviewed the last time.

 One of the main concerns was about making CPU detection initialization a
 constructor. The main point raised was about constructor ordering. I have now
 added a priority value to the CPU detection constructor to make it very high
 priority so that it is guaranteed to fire before every constructor without
 an explicitly marked priority value of 101.  However, IFUNC initializers
 will still fire before this constructor, so the cpu initialization routine
 has to be explicitly called in such initializers for which I have added a
 builtin: __builtin_cpu_init ().

 I would like to reopen discussions on this to make it suitable for trunk
 this time around.

 This patch adds the following new builtins:

 __builtin_cpu_init
 __builtin_cpu_supports_cmov
 __builtin_cpu_supports_mmx
 __builtin_cpu_supports_popcount
 __builtin_cpu_supports_sse
 __builtin_cpu_supports_sse2
 __builtin_cpu_supports_sse3
 __builtin_cpu_supports_ssse3
 __builtin_cpu_supports_sse4_1
 __builtin_cpu_supports_sse4_2
 __builtin_cpu_is_amd
 __builtin_cpu_is_intel_atom
 __builtin_cpu_is_intel_core2
 __builtin_cpu_is_intel
 __builtin_cpu_is_intel_corei7
 __builtin_cpu_is_intel_corei7_nehalem
 __builtin_cpu_is_intel_corei7_westmere
 __builtin_cpu_is_intel_corei7_sandybridge
 __builtin_cpu_is_amdfam10
 __builtin_cpu_is_amdfam10_barcelona
 __builtin_cpu_is_amdfam10_shanghai
 __builtin_cpu_is_amdfam10_istanbul
 __builtin_cpu_is_amdfam15_bdver1
 __builtin_cpu_is_amdfam15_bdver2


        * config/i386/i386.c (build_struct_with_one_bit_fields): New function.
        (make_var_decl): New function.
        (get_field_from_struct): New function.
        (fold_builtin_target): New function.
        (ix86_fold_builtin): New function.
        (ix86_expand_builtin): Expand new builtins by folding them.
        (make_platform_builtin): New functions.
        (ix86_init_platform_type_builtins): Make the new builtins.
        (ix86_init_builtins): Make new builtins to detect CPU type.
        (TARGET_FOLD_BUILTIN): New macro.
        (IX86_BUILTIN_CPU_SUPPORTS_CMOV): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_MMX): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_POPCOUNT): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE2): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE3): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSSE3): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE4_1): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE4_2): New enum value.
        (IX86_BUILTIN_CPU_INIT): New enum value.
        (IX86_BUILTIN_CPU_IS_AMD): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_ATOM): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_CORE2): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_WESTMERE): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_SANDYBRIDGE): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM10_SHANGHAI): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM10_ISTANBUL): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM15H_BDVER1): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM15H_BDVER2): New enum value.
        * config/i386/i386-builtin-types.def: New function type.
        * testsuite/gcc.target/builtin_target.c: New testcase.

        * libgcc/config/i386/i386-cpuinfo.c: New file.
        * libgcc/config/i386/t-cpuinfo: New file.
        * libgcc/config.host: Include t-cpuinfo.
        * libgcc/config/i386/libgcc-glibc.ver: Version symbols __cpu_model
        and __cpu_features.



 Index: libgcc/config.host
 ===
 --- libgcc/config.host  (revision 184644)
 +++ libgcc/config.host  (working copy)
 @@ -1128,7 +1128,7 @@ i[34567]86-*-linux* | x86_64-*-linux* | \
   i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
   i[34567]86-*-knetbsd*-gnu | \
   i[34567]86-*-gnu*)
 -       tmake_file=${tmake_file} t-tls i386/t-linux
 +       tmake_file=${tmake_file} t-tls i386/t-linux i386/t-cpuinfo
        if test $libgcc_cv_cfi = yes; then
                tmake_file=${tmake_file} t-stack i386/t-stack-i386
        fi
 Index: libgcc/config/i386/t-cpuinfo
 ===
 --- libgcc/config/i386/t-cpuinfo        

Re: [SPARC] Tweak libgomp's cpu_relax

2012-03-01 Thread David Miller
From: Eric Botcazou ebotca...@adacore.com
Date: Wed, 29 Feb 2012 21:48:57 +0100

 As discussed with DaveM, this duplicates libitm's cpu_relax into libgomp.
 
 Tested on SPARC64/Linux, applied on the mainline.

Thanks for taking care of this Eric.


Re: [gimplefe][patch] The symbol table for declarations

2012-03-01 Thread Sandeep Soni
On Wed, Feb 29, 2012 at 8:14 PM, Diego Novillo dnovi...@google.com wrote:
 On 24/02/12 01:03 , Sandeep Soni wrote:

 +  name_token = gl_consume_expected_token (parser-lexer, CPP_NAME);
 +  name = gl_token_as_text (name_token);
 +
 +  e = ggc_alloc_cleared_gimple_symtab_entry_def ();
 +  e-id = get_identifier(name);
 +  slot = htab_find_slot (gimple_symtab, e, NO_INSERT);
 +  if (!slot)


 Why not just use INSERT here?  If the slot is empty, you can then test 'if
 (*slot == NULL)' (since the INSERT operation guarantees that 'slot' will be
 non-NULL.

 Also, please factor this code to a helper function to abstract the hash
 table operations.   We will later want to add a pure lookup routine and we
 may want to add symbols to the symbol table from other contexts.

Done with the above changes. The hash table operations are abstracted
out to two helper functions. Also added is a function to lazily
initialize the hash table similar to the one we have in the LTO front
end.

The patch is attached. Up for review. The changelog is as follows:
2012-03-01  Sandeep Soni  soni.sande...@gmail.com

* parser.c : Include hashtab.h.
(gimple_symtab): New. The symbol table.
(gimple_symtab_entry_hash): New.
(gimple_symtab_eq_hash): New.
(gimple_symtab_entry_marked_p):New.
(gimple_symtab_maybe_init_hash_table):New.
(gimple_symtab_register_decl):New.
(gimple_register_var_decl_in_symtab):New.
(gp_parse_var_decl): Put declaration in the symbol table.
(gimple_main): Creates the symbol table
* parser.h : (struct gimple_symtab_entry_def): New.

2011-10-11  Sandeep Soni  soni.sande...@gmail.com

* parser.c (gp_parse_var_decl): Fixed a bug for the
missing symbol 'CPP_LESS' in the 'INTEGER_TYPE' declaration.


-- 
Cheers
Sandy
Index: gcc/gimple/parser.h
===
--- gcc/gimple/parser.h	(revision 174754)
+++ gcc/gimple/parser.h	(working copy)
@@ -27,6 +27,19 @@
 #include vec.h
 
 
+/* The GIMPLE symbol table entry.  */
+
+struct GTY(()) gimple_symtab_entry_def 
+{
+  /* symbol table entry key, an identifier.  */
+  tree id;
+
+  /* symbol table entry, a DECL.  */
+  tree decl;
+};
+
+typedef struct gimple_symtab_entry_def *gimple_symtab_entry_t;
+
 /* A GIMPLE token.  */
 
 typedef struct GTY(()) gimple_token {
@@ -81,7 +94,7 @@
   struct GTY((skip)) ht *ident_hash;
 } gimple_parser;
 
-
+ 
 /* In parser.c  */
 extern void gimple_main (void);
 
Index: gcc/gimple/parser.c
===
--- gcc/gimple/parser.c	(revision 174754)
+++ gcc/gimple/parser.c	(working copy)
@@ -28,6 +28,7 @@
 #include tree.h
 #include gimple.h
 #include parser.h
+#include hashtab.h
 #include ggc.h
 
 /* The GIMPLE parser.  Note: do not use this variable directly.  It is
@@ -44,6 +45,84 @@
 /* EOF token.  */
 static gimple_token gl_eof_token = { CPP_EOF, 0, 0, 0 };
 
+/* Gimple symbol table.  */
+
+static GTY ((if_marked (gimple_symtab_entry_marked_p),
+	 param_is (struct gimple_symtab_entry_def)))
+  htab_t gimple_symtab;
+
+/* Return the hash value of the declaration name of a gimple_symtab_entry_def
+   object pointed by ENTRY.  */
+
+static hashval_t
+gimple_symtab_entry_hash (const void *entry)
+{
+  const struct gimple_symtab_entry_def *base =
+(const struct gimple_symtab_entry_def *)entry;
+  return IDENTIFIER_HASH_VALUE (base-id);
+}
+
+/* Returns non-zero if ENTRY1 and ENTRY2 point to gimple_symtab_entry_def
+   objects corresponding to the same declaration.  */
+
+static int
+gimple_symtab_eq_hash (const void *entry1, const void *entry2)
+{
+  const struct gimple_symtab_entry_def *base1 =
+(const struct gimple_symtab_entry_def *)entry1;
+  const struct gimple_symtab_entry_def *base2 =
+(const struct gimple_symtab_entry_def *)entry2;
+
+  return (base1-id == base2-id);
+}
+
+/* Returns non-zero if P points to an gimple_symtab_entry_def struct that needs
+   to be marked for GC.  */
+
+static int
+gimple_symtab_entry_marked_p (const void *p)
+{
+  const struct gimple_symtab_entry_def *base =
+ (const struct gimple_symtab_entry_def *) p;
+
+  /* Keep this only if the common IDENTIFIER_NODE of the symtab chain
+ is marked which it will be if at least one of the DECLs in the
+ chain is marked.  */
+  return ggc_marked_p (base-id);
+}
+
+
+/* Lazily initialize hash tables.  */
+
+static void
+gimple_symtab_maybe_init_hash_table (void)
+{
+  if (gimple_symtab)
+return;
+
+  gimple_symtab =
+htab_create_ggc (1021, gimple_symtab_entry_hash,
+		 gimple_symtab_eq_hash, NULL);
+}
+
+/* Registers DECL with the gimple symbol table as having identifier ID.  */
+
+static void
+gimple_symtab_register_decl (tree decl, tree id)
+{
+  gimple_symtab_entry_t new_entry;
+  void **slot;
+
+  new_entry = ggc_alloc_cleared_gimple_symtab_entry_def ();
+  new_entry-id = id;
+  new_entry-decl = decl;
+
+  

[PATCH] gfortran testsuite: implicitly cleanup-modules

2012-03-01 Thread Bernhard Reutner-Fischer
Hi,

By now we have quite some leftover modules in the testsuite, again.
Given that the previous suggestion in this thread -- to have a separate
script in contrib -- did not trigger any reaction, let me suggest the
patch below instead.

Teach the testsuite to cleanup the modules.
We do this by grepping for the module names and implicitly deleting them
when the test is finished. For the testcases that use modules from other
files we introduce a keep-modules procedure that keeps either all (,
i.e. empty list) or the given modules of the source file.

A follow-up patch would remove the now superfluous cleanup-module calls
in the remaining testcases. Since that patch is pretty big (~360k) i do
not intend to send it in but want to apply it straight to the repo (it's
just a sed '/cleanup-modules/d' on the testcases that do not occur in
the below patch).

Is it ok to reference ../doc in the ChangeLog entry below to keep the
documentation change associated with the script itself?


The patch was bootstrapped and regression tested using tcl-8.5 on
x86_64-linux-gnu with no new regressions.

Ok for trunk?
Thanks,

gcc/testsuite/ChangeLog:

2012-02-28  Bernhard Reutner-Fischer  al...@gcc.gnu.org

* gfortran.fortran-torture/compile/compile.exp: Simplify.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* lib/gcc-dg.exp (cleanup-modules): Move to ..
* lib/fortran-modules.exp: .. this new file. Adjust users.
* ../doc/sourcebuild.texi (cleanup-modules, keep-modules): Update
documentation.
* lib/gfortran-dg.exp (gfortran-dg-runtest,
gfortran-dg-debug-runtest): Call cleanup-modules.
* lib/fortran-torture.exp (fortran-torture-execute,
fortran-torture): Likewise.
* gfortran.dg/coarray/caf.exp: Likewise.
* lib/lto.exp: Likewise.
* gfortran.dg/class_4a.f03: Adjust cleanup-modules and keep-modules.
* gfortran.dg/class_4b.f03: Likewise.
* gfortran.dg/class_4c.f03: Likewise.
* gfortran.dg/class_45a.f03: Likewise.
* gfortran.dg/binding_label_tests_10.f03: Likewise.
* gfortran.dg/binding_label_tests_10_main.f03: Likewise.
* gfortran.dg/binding_label_tests_11.f03: Likewise.
* gfortran.dg/binding_label_tests_11_main.f03: Likewise.
* gfortran.dg/binding_label_tests_13.f03: Likewise.
* gfortran.dg/binding_label_tests_13_main.f03: Likewise.
* gfortran.dg/test_common_binding_labels_2.f03: Likewise.
* gfortran.dg/test_common_binding_labels_2_main.f03: Likewise.
* gfortran.dg/test_common_binding_labels_3.f03: Likewise.
* gfortran.dg/test_common_binding_labels_3_main.f03: Likewise.
* gfortran.dg/whole_file_28.f90: Likewise.
* gfortran.dg/whole_file_29.f90: Likewise.
* gfortran.dg/whole_file_30.f90: Likewise.
* gfortran.dg/whole_file_31.f90: Likewise.

Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
 gcc/doc/sourcebuild.texi   |   35 +++-
 .../gfortran.dg/binding_label_tests_10.f03 |3 +-
 .../gfortran.dg/binding_label_tests_10_main.f03|3 +-
 .../gfortran.dg/binding_label_tests_11.f03 |3 +-
 .../gfortran.dg/binding_label_tests_11_main.f03|3 +-
 .../gfortran.dg/binding_label_tests_13.f03 |1 +
 .../gfortran.dg/binding_label_tests_13_main.f03|3 +-
 gcc/testsuite/gfortran.dg/class_45a.f03|1 +
 gcc/testsuite/gfortran.dg/class_4a.f03 |1 +
 gcc/testsuite/gfortran.dg/class_4b.f03 |1 +
 gcc/testsuite/gfortran.dg/class_4c.f03 |3 +-
 gcc/testsuite/gfortran.dg/coarray/caf.exp  |3 +
 .../gfortran.dg/test_common_binding_labels_2.f03   |2 +-
 .../test_common_binding_labels_2_main.f03  |3 +-
 .../gfortran.dg/test_common_binding_labels_3.f03   |1 +
 .../test_common_binding_labels_3_main.f03  |3 +-
 gcc/testsuite/gfortran.dg/whole_file_28.f90|1 +
 gcc/testsuite/gfortran.dg/whole_file_29.f90|2 +-
 gcc/testsuite/gfortran.dg/whole_file_30.f90|1 +
 gcc/testsuite/gfortran.dg/whole_file_31.f90|2 +-
 .../gfortran.fortran-torture/compile/compile.exp   |   65 +-
 .../gfortran.fortran-torture/execute/execute.exp   |   65 +-
 gcc/testsuite/lib/fortran-modules.exp  |   98 
 gcc/testsuite/lib/fortran-torture.exp  |5 +
 gcc/testsuite/lib/gcc-dg.exp   |8 +--
 gcc/testsuite/lib/gfortran-dg.exp  |4 +
 gcc/testsuite/lib/lto.exp  |9 ++-
 27 files changed, 172 insertions(+), 157 deletions(-)
 create mode 100644 gcc/testsuite/lib/fortran-modules.exp

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index ea6fedb..fc6f3e6 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2107,8 +2107,39 @@ Removes 

[patch committed SH] Fix comment typo

2012-03-01 Thread Oleg Endo
Just committed the attached patch as obvious.

Cheers,
Oleg

2012-03-01  Oleg Endo  olege...@gcc.gnu.org

* config/sh/constraints.md: Fix comment typo.

Index: gcc/config/sh/constraints.md
===
--- gcc/config/sh/constraints.md	(revision 184757)
+++ gcc/config/sh/constraints.md	(working copy)
@@ -139,7 +139,7 @@
(match_test ival = 0  ival = 255)))
  
 (define_constraint K12
-  An unsigned 8-bit constant, as used in SH2A 12-bit displacement addressing.
+  An unsigned 12-bit constant, as used in SH2A 12-bit displacement addressing.
   (and (match_code const_int)
(match_test ival = 0  ival = 4095)))
 


Re: [google/4.6]Backport r184061 from upstream 4.6 (issue5712053)

2012-03-01 Thread Jing Yu
The patch will be auto-merged into google/gcc-4_6 in near future.
I will cherry-pick it into google/gcc-4_6_2-mobile.

On Thu, Mar 1, 2012 at 10:50 AM, Jing Yu jin...@google.com wrote:
 Backport r184061 from gcc-4_6 branch to fix an invalid
 constant simplification (PR52060).

 bootstrap and crosstool tests pass.

 OK for google/gcc-4_6 and google/gcc-4_6_2-mobile?


 2012-03-01  Jing Yu  jin...@google.com
        Backport r184061 from gcc-4_6-branch to fix PR52060.

        2012-02-07  Jakub Jelinek  ja...@redhat.com
        PR rtl-optimization/52060
        * gcc.dg/torture/pr52060.c: New test.

 2012-03-01   Jing Yu  jin...@google.com
        Backport r184061 from gcc-4_6-branch to fix PR52060.

        2012-02-07  Jakub Jelinek  ja...@redhat.com
        PR rtl-optimization/52060
        * combine.c (try_combine): Add i0src_copy and i0src_copy2 variables,
        copy i1src to i1src_copy whenever added_sets_2  i1_feeds_i2_n
        already before i1dest - i1src substitution in newpat, copy i0src
        to i0src_copy and/or i0src_copy2 when needed.


 Index: testsuite/ChangeLog.google-4_6
 ===
 --- testsuite/ChangeLog.google-4_6      (revision 184667)
 +++ testsuite/ChangeLog.google-4_6      (working copy)
 @@ -1,3 +1,10 @@
 +2012-03-01  Jing Yu  jin...@google.com
 +       Backport r184061 from gcc-4_6-branch to fix PR52060.
 +
 +       2012-02-07  Jakub Jelinek  ja...@redhat.com
 +       PR rtl-optimization/52060
 +       * gcc.dg/torture/pr52060.c: New test.
 +
  2012-02-19  Jeffrey Yasskin jyass...@google.com
         Backport r183223 from gcc-4_6-branch to fix a segfault in C++11
        mode.
 Index: testsuite/gcc.dg/torture/pr52060.c
 ===
 --- testsuite/gcc.dg/torture/pr52060.c  (revision 0)
 +++ testsuite/gcc.dg/torture/pr52060.c  (revision 0)
 @@ -0,0 +1,57 @@
 +/* PR rtl-optimization/52060 */
 +/* { dg-do run { target int32plus } } */
 +
 +extern void abort (void);
 +union U { float f; unsigned int i; };
 +
 +static inline __attribute__((always_inline)) unsigned int
 +foo (float x)
 +{
 +  union U u;
 +  unsigned int a, b, c;
 +  int d;
 +  int e;
 +  u.f = x;
 +  d = ((unsigned) u.i  23)  0xFF;
 +  c = d  126 ? 0 : ~0;
 +  e = 127 + 30 - d;
 +  a = (u.i  8) | 0x8000U;
 +  b = a  ((1  e) - 1);
 +  a = a  e;
 +  c = (b | (a  2)) ? ~0 : ~1;
 +  a = ((a + 1U)  1)  c;
 +  return a;
 +}
 +
 +__attribute__((noinline)) unsigned int
 +bar (float x)
 +{
 +  unsigned int a, b, c;
 +  static const unsigned int d[128] =
 +  {
 +    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 +    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 +    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 +    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 +    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 +    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 +    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 +    3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 7
 +  };
 +  a = foo (1048575.0f * x);
 +  c = d[a  13];
 +  b = (c  13) | ((a  (7 - c))  0x1fff);
 +  return b;
 +}
 +
 +int
 +main ()
 +{
 +  union U u;
 +  u.f = 1048575.0f;
 +  if (sizeof (u.i) == sizeof (u.f)
 +       u.i == 0x4970U
 +       bar (1.0f) != 65535)
 +    abort ();
 +  return 0;
 +}
 Index: ChangeLog.google-4_6
 ===
 --- ChangeLog.google-4_6        (revision 184667)
 +++ ChangeLog.google-4_6        (working copy)
 @@ -1,3 +1,13 @@
 +2012-03-01   Jing Yu  jin...@google.com
 +       Backport r184061 from gcc-4_6-branch to fix PR52060.
 +
 +       2012-02-07  Jakub Jelinek  ja...@redhat.com
 +       PR rtl-optimization/52060
 +       * combine.c (try_combine): Add i0src_copy and i0src_copy2 variables,
 +       copy i1src to i1src_copy whenever added_sets_2  i1_feeds_i2_n
 +       already before i1dest - i1src substitution in newpat, copy i0src
 +       to i0src_copy and/or i0src_copy2 when needed.
 +
  2012-02-21   Jing Yu  jin...@google.com

        Google Ref 47894
 Index: combine.c
 ===
 --- combine.c   (revision 184667)
 +++ combine.c   (working copy)
 @@ -2551,8 +2551,8 @@
   rtx i3dest_killed = 0;
   /* SET_DEST and SET_SRC of I2, I1 and I0.  */
   rtx i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0;
 -  /* Copy of SET_SRC of I1, if needed.  */
 -  rtx i1src_copy = 0;
 +  /* Copy of SET_SRC of I1 and I0, if needed.  */
 +  rtx i1src_copy = 0, i0src_copy = 0, i0src_copy2 = 0;
   /* Set if I2DEST was reused as a scratch register.  */
   bool i2scratch = false;
   /* The PATTERNs of I0, I1, and I2, or a copy of them in certain cases.  */
 @@ -3164,6 +3164,11 @@
       n_occurrences = 0;
       subst_low_luid = DF_INSN_LUID (i1);

 +      /* If the following substitution will modify I1SRC, make a copy of it
 +        for the case where it is substituted for I1DEST in 

Re: [google][4.6]Bug fix to function reordering plugin to check presence of elf.h

2012-03-01 Thread Jing Yu
I ported this patch into google/gcc-4_6_2-mobile.
Thanks,
Jing

On Sat, Feb 25, 2012 at 1:40 PM, Sriraman Tallam tmsri...@google.com wrote:
 Committed now, thanks.

 -Sri.

 On Fri, Feb 24, 2012 at 11:18 PM, Xinliang David Li davi...@google.com 
 wrote:
 ok.

 David

 On Fri, Feb 24, 2012 at 4:19 PM, Sriraman Tallam tmsri...@google.com wrote:
 function_reordering_plugin.c includes elf.h which is not available
 on non-ELF platforms building a cross-compiler. This patch checks for
 elf.h before including it. Otherwise, it redefines the macros used.
 This is safe becaue the macros will not change.

 For context, this linker plugin itself is only available in the google
 4_6 branch and I will port it to other branches and make it available
 for review for trunk soon.


 2012-02-24  Sriraman Tallam  tmsri...@google.com

        * function_reordering_plugin.c: Check for presence of elf.h.
        Otherwise, redefine the elf macros used.

 Ok to commit?

 Thanks,
 -Sri.


Re: [SH] PR 49468 - DImode abs

2012-03-01 Thread Kaz Kojima
Oleg Endo oleg.e...@t-online.de wrote:
 2012-03-01  Oleg Endo  olege...@gcc.gnu.org
 
   PR target/49486
   * config/sh/sh.md (negdi2): Add TARGET_SH1 condition.
   (absdi2): New expander.
   (*absdi2, *negabsdi2, negdi_cond): New insns and splits.
 
 
 testsuite/ChangeLog:
 
 2012-03-01  Oleg Endo  olege...@gcc.gnu.org
 
   PR target/49486
   * gcc.target/sh/pr49468-si.c: Skip unsupported test for SH64.
   * gcc.target/sh/pr49468-di.c: New.

OK for 4.8.

Regards,
kaz


Re: [SH] Add support for tas.b instruction

2012-03-01 Thread Kaz Kojima
Oleg Endo oleg.e...@t-online.de wrote:
 The attached patch adds support for the SH tas.b instruction by
 introducing a new target option -menable-tas.
 The patch was tested against rev 184589 with...
[snip]
 Other than that, OK for 4.8?
 
 Cheers,
 Oleg
 
 2012-03-01  Oleg Endo  olege...@gcc.gnu.org
 
   * config/sh/sh.h (TARGET_ATOMIC_TEST_AND_SET_TRUEVAL): New hook.
   * config/sh/sync.md (atomic_test_and_set): New expander.
   (tasb, atomic_test_and_set_soft): New insns.
   * config/sh/sh.opt (menable-tas): New option.
   * doc/invoke.texi (SH Options): Document it.

OK for 4.8.  When applying it, please take care of updating
copyright years.

Regards,
kaz


Re: [SH] Remove dead tertiary_reload_operand function

2012-03-01 Thread Kaz Kojima
Oleg Endo oleg.e...@t-online.de wrote:
 The function tertiary_reload_operand in sh.c seems to be dead code.  The
 attached patch deletes it.
 
 Tested with: make all-gcc
 
 OK to apply?
 
 Cheers,
 Oleg
 
 2012-03-01  Oleg Endo  olege...@gcc.gnu.org
 
   * config/sh/sh-protos.h (tertiary_reload_operand): Remove dead
   function.
   * config/sh/sh.c (tertiary_reload_operand): Likewise.

OK with updating copyright years.

Regards,
kaz


Re: [patch committed SH] Fix comment typo

2012-03-01 Thread Kaz Kojima
Oleg Endo oleg.e...@t-online.de wrote:
 Just committed the attached patch as obvious.
 
 Cheers,
 Oleg
 
 2012-03-01  Oleg Endo  olege...@gcc.gnu.org
 
   * config/sh/constraints.md: Fix comment typo.

Updating copyright years is needed.

Regards,
kaz


Re: [PATCH] [SH] Fix target/48596

2012-03-01 Thread Oleg Endo
On Thu, 2012-03-01 at 13:11 +0900, Kaz Kojima wrote:
 Hi,
 
 The attached patch is to avoid PR target/48596 which is a 4.7
 regression on SH.  It seems that now IRA aggressively tried to
 use fp regs as the holder for memory addresses on this port.
 SH requires a special fpul register to move from the fp regs to
 the general regs which are legitimate for pointers and, in
 the problematic situation, fpul is already reserved for reload
 and the spill failure resulted for the reg equiv processing in RA.
 I guess that no other targets have such restrictions.  Perhaps
 if there eas a direct way to notify IRA that some register classes
 will be too costly for the addresses, SH port will utilize it,
 though it looks to be invasive.
 
 The patch tries to work around the problem with increasing the move
 cost between fp and general registers for SImode.  The usual tests
 are done successfully on sh4-unknown-linux-gnu with no new failures.
 A bit surprisingly, there are no size/performance regressions and
 a few code size improvements with CSiBE tests I've done.
 I'd like to hear the suggestions from the experts before applying
 this work around.
 

I was afraid that with this patch, in the following use case ...

int32_t float_as_int (float val)
{
  union { float f; int32_t i; } u;
  u.f = val;
  return u.i;
}

... the value would somehow get pushed/popped through the stack.
Luckily this is not the case, it still goes through the fpul register :)

__Z12float_as_intf:
fldsfr5,fpul
rts 
sts fpul,r0

(I've got a similar use case where it does go through the stack, but it
also happens without the patch...)

BTW, the patch also seems to fix PR 48806.

Cheers,
Oleg




Re: [SH] Remove dead tertiary_reload_operand function

2012-03-01 Thread Oleg Endo
On Fri, 2012-03-02 at 06:45 +0900, Kaz Kojima wrote:
 Oleg Endo oleg.e...@t-online.de wrote:
  The function tertiary_reload_operand in sh.c seems to be dead code.  The
  attached patch deletes it.
  
  Tested with: make all-gcc
  
  OK to apply?
  
  Cheers,
  Oleg
  
  2012-03-01  Oleg Endo  olege...@gcc.gnu.org
  
  * config/sh/sh-protos.h (tertiary_reload_operand): Remove dead
  function.
  * config/sh/sh.c (tertiary_reload_operand): Likewise.
 
 OK with updating copyright years.
 

I will go through the other SH source files and fix the copyright years
in a separate patch, OK?



Support for getting CPU type and feature information at run-time (issue5715051)

2012-03-01 Thread Sriraman Tallam
Removing [google] prefix from the subject line.

On Thu, Mar 1, 2012 at 12:54 PM, Xinliang David Li davi...@google.com wrote:
 Sri, probably need to remove the [google] prefix in the subject line
 to prevent this from being filtered.

 David

 On Thu, Mar 1, 2012 at 12:45 PM, Sriraman Tallam tmsri...@google.com wrote:
 Patch to add builtins to detect CPU type:
 

 I have ported the patch from google/gcc-4_6 to google/main.  I also want this
 patch to be considered for trunk.  Please see this discussion:
 http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01355.html
 when this patch for reviewed the last time.

 One of the main concerns was about making CPU detection initialization a
 constructor. The main point raised was about constructor ordering. I have now
 added a priority value to the CPU detection constructor to make it very high
 priority so that it is guaranteed to fire before every constructor without
 an explicitly marked priority value of 101.  However, IFUNC initializers
 will still fire before this constructor, so the cpu initialization routine
 has to be explicitly called in such initializers for which I have added a
 builtin: __builtin_cpu_init ().

 I would like to reopen discussions on this to make it suitable for trunk
 this time around.

 This patch adds the following new builtins:

 __builtin_cpu_init
 __builtin_cpu_supports_cmov
 __builtin_cpu_supports_mmx
 __builtin_cpu_supports_popcount
 __builtin_cpu_supports_sse
 __builtin_cpu_supports_sse2
 __builtin_cpu_supports_sse3
 __builtin_cpu_supports_ssse3
 __builtin_cpu_supports_sse4_1
 __builtin_cpu_supports_sse4_2
 __builtin_cpu_is_amd
 __builtin_cpu_is_intel_atom
 __builtin_cpu_is_intel_core2
 __builtin_cpu_is_intel
 __builtin_cpu_is_intel_corei7
 __builtin_cpu_is_intel_corei7_nehalem
 __builtin_cpu_is_intel_corei7_westmere
 __builtin_cpu_is_intel_corei7_sandybridge
 __builtin_cpu_is_amdfam10
 __builtin_cpu_is_amdfam10_barcelona
 __builtin_cpu_is_amdfam10_shanghai
 __builtin_cpu_is_amdfam10_istanbul
 __builtin_cpu_is_amdfam15_bdver1
 __builtin_cpu_is_amdfam15_bdver2


        * config/i386/i386.c (build_struct_with_one_bit_fields): New function.
        (make_var_decl): New function.
        (get_field_from_struct): New function.
        (fold_builtin_target): New function.
        (ix86_fold_builtin): New function.
        (ix86_expand_builtin): Expand new builtins by folding them.
        (make_platform_builtin): New functions.
        (ix86_init_platform_type_builtins): Make the new builtins.
        (ix86_init_builtins): Make new builtins to detect CPU type.
        (TARGET_FOLD_BUILTIN): New macro.
        (IX86_BUILTIN_CPU_SUPPORTS_CMOV): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_MMX): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_POPCOUNT): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE2): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE3): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSSE3): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE4_1): New enum value.
        (IX86_BUILTIN_CPU_SUPPORTS_SSE4_2): New enum value.
        (IX86_BUILTIN_CPU_INIT): New enum value.
        (IX86_BUILTIN_CPU_IS_AMD): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_ATOM): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_CORE2): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_NEHALEM): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_WESTMERE): New enum value.
        (IX86_BUILTIN_CPU_IS_INTEL_COREI7_SANDYBRIDGE): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM10_BARCELONA): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM10_SHANGHAI): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM10_ISTANBUL): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM15H_BDVER1): New enum value.
        (IX86_BUILTIN_CPU_IS_AMDFAM15H_BDVER2): New enum value.
        * config/i386/i386-builtin-types.def: New function type.
        * testsuite/gcc.target/builtin_target.c: New testcase.

        * libgcc/config/i386/i386-cpuinfo.c: New file.
        * libgcc/config/i386/t-cpuinfo: New file.
        * libgcc/config.host: Include t-cpuinfo.
        * libgcc/config/i386/libgcc-glibc.ver: Version symbols __cpu_model
        and __cpu_features.



 Index: libgcc/config.host
 ===
 --- libgcc/config.host  (revision 184644)
 +++ libgcc/config.host  (working copy)
 @@ -1128,7 +1128,7 @@ i[34567]86-*-linux* | x86_64-*-linux* | \
   i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
   i[34567]86-*-knetbsd*-gnu | \
   i[34567]86-*-gnu*)
 -       tmake_file=${tmake_file} t-tls i386/t-linux
 +       tmake_file=${tmake_file} t-tls i386/t-linux i386/t-cpuinfo
        if test $libgcc_cv_cfi = yes; then
                tmake_file=${tmake_file} t-stack i386/t-stack-i386
        fi
 Index: 

Re: [SH] Remove dead tertiary_reload_operand function

2012-03-01 Thread Kaz Kojima
Oleg Endo oleg.e...@t-online.de wrote:
 I will go through the other SH source files and fix the copyright years
 in a separate patch, OK?

OK.

Regards,
kaz


Re: [v3] Update Solaris baselines for GCC 4.7, take 2

2012-03-01 Thread Benjamin Kosnik

 After PRs libstdc++/52188 and libstdc++/52189 have been resolved, I'd
 finally like to update the Solaris baselines for the 4.7 release.
 This time, everything looks good: only additions to GLIBCXX_3.4.1[67],
 CXXABI_1.3.6, and CXXABI_TM_1, as expected.
 
 Bootstrapped without regressions on i386-pc-solaris2.{8, 9, 10, 11}
 and sparc-sun-solaris2.{8, 9, 10, 11} with as/ld, gas/ld, and
 gas/gld.  Also verified that there are no additions in
 $target/libstdc++/testsuite/libstdc++.log.sep.


This looks way better, thanks for you work on cleaning this up. What a
relief!

I was surprised to see GLIBCXX_3.4.15 symbols added, but then realized
you added the complete set so this seems fine. 

 There are only two FAILs: on Solaris 10 and 11/x86 with as,
 _GLOBAL_OFFSET_TABLE_ is missing from the base version.  The jury is
 still out whether this is an assembler or linker bug.  I think about
 filtering out those symbols bound to the base version (which are
 prescribed by the Solaris ABI, but have nothing to do with the
 libstdc++.so interface) in a subsequent (4.8) patch, but for now this
 is good enough.


OK, and thanks.
 
best,
Benjamin


Re: [v3] Update Solaris baselines for GCC 4.7, take 2

2012-03-01 Thread Benjamin De Kosnik

 I was surprised to see GLIBCXX_3.4.15 symbols added, but then realized
 you added the complete set so this seems fine. 

I meant to say: surprised to see GLIBCXX_3.4.16 symbols added, but then
you the complete set so this seems fine. So the only added symbols are
the complete set of GLIBCXX_3.4.16 and then the usual GLIBCXX_3.4.17
ones. Looks good.

-benjamin



[patch committed SH] Update copyright years

2012-03-01 Thread Oleg Endo
Committed the attached patch as rev 184764 to update copyright years in
several SH target source files.

Cheers,
Oleg

2012-03-01  Oleg Endo  olege...@gcc.gnu.org

* config/sh/sh-protos.h: Update copyright notice dates.
* config/sh/sh.h: Likewise.
* config/sh/sh.md: Likewise.
* config/sh/constraints.md: Likewise.
* config/sh/predicates.md: Likewise.

Index: gcc/config/sh/predicates.md
===
--- gcc/config/sh/predicates.md	(revision 184762)
+++ gcc/config/sh/predicates.md	(working copy)
@@ -1,5 +1,5 @@
 ;; Predicate definitions for Renesas / SuperH SH.
-;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
+;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012
 ;; Free Software Foundation, Inc.
 ;;
 ;; This file is part of GCC.
Index: gcc/config/sh/sh-protos.h
===
--- gcc/config/sh/sh-protos.h	(revision 184763)
+++ gcc/config/sh/sh-protos.h	(working copy)
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler for Renesas / SuperH SH.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2003,
-   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Steve Chamberlain (s...@cygnus.com).
Improved by Jim Wilson (wil...@cygnus.com).
Index: gcc/config/sh/sh.h
===
--- gcc/config/sh/sh.h	(revision 184762)
+++ gcc/config/sh/sh.h	(working copy)
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler for Renesas / SuperH SH.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Steve Chamberlain (s...@cygnus.com).
Improved by Jim Wilson (wil...@cygnus.com).
Index: gcc/config/sh/constraints.md
===
--- gcc/config/sh/constraints.md	(revision 184762)
+++ gcc/config/sh/constraints.md	(working copy)
@@ -1,5 +1,5 @@
 ;; Constraint definitions for Renesas / SuperH SH.
-;; Copyright (C) 2007, 2008, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2008, 2011, 2012 Free Software Foundation, Inc.
 ;;
 ;; This file is part of GCC.
 ;;
Index: gcc/config/sh/sh.md
===
--- gcc/config/sh/sh.md	(revision 184762)
+++ gcc/config/sh/sh.md	(working copy)
@@ -1,6 +1,6 @@
 ;;- Machine description for Renesas / SuperH SH.
 ;;  Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-;;  2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+;;  2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
 ;;  Free Software Foundation, Inc.
 ;;  Contributed by Steve Chamberlain (s...@cygnus.com).
 ;;  Improved by Jim Wilson (wil...@cygnus.com).


Re: [PATCH] [SH] Fix target/48596

2012-03-01 Thread Kaz Kojima
Oleg Endo oleg.e...@t-online.de wrote:
 BTW, the patch also seems to fix PR 48806.

Ah, I've confirmed it.  Thanks for pointing it out.

Regards,
kaz


Re: Fix 64-bit *intmax_t definitions on IRIX

2012-03-01 Thread Richard Sandiford
Rainer Orth r...@cebitec.uni-bielefeld.de writes:
 2012-02-22  Rainer Orth  r...@cebitec.uni-bielefeld.de

   * config/mips/iris6.h [!USED_FOR_TARGET] (long_intmax): Declare.
   (INTMAX_TYPE): Use it.
   (UINTMAX_TYPE): Likewise.
   (SUBTARGET_OVERRIDE_OPTIONS): Define.
   (irix6_c_common_override_options): Declare.
   (C_COMMON_OVERRIDE_OPTIONS): Define.
   * config/mips/mips.c [TARGET_IRIX6] (long_intmax): Define.
   * config/mips/irix6-c.c: New file.
   * config/mips/t-irix6 (irix6-c.o): New target.
   * config.gcc (mips-sgi-irix6.5): Set c_target_objs,
   cxx_target_objs.

OK for mips.c bit, thanks.  Everything else is yours.

Richard


[v3] tweak cleanfiles

2012-03-01 Thread Benjamin De Kosnik

noticed these bits hanging out after a make clean in testsuite. Fixed.

tested x86/linux
-benjamin2012-03-01  Benjamin Kosnik  b...@redhat.com

	* testsuite/Makefile.am (CLEANFILES): Add *.gdb.
	* testsuite/Makefile.in: Regenerate.

diff --git a/libstdc++-v3/testsuite/Makefile.am b/libstdc++-v3/testsuite/Makefile.am
index e977451..166bd16 100644
--- a/libstdc++-v3/testsuite/Makefile.am
+++ b/libstdc++-v3/testsuite/Makefile.am
@@ -1,7 +1,7 @@
 ## Makefile for the testsuite subdirectory of the GNU C++ Standard library.
 ##
 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-## 2011 Free Software Foundation, Inc.
+## 2011, 2012 Free Software Foundation, Inc.
 ##
 ## This file is part of the libstdc++ version 3 distribution.
 ## Process this file with automake to produce Makefile.in.
@@ -255,8 +255,8 @@ check-profile: site.exp
 # By adding these files here, automake will remove them for 'make clean'
 CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
 	 testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
-	 *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out
+	 *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb
 
 # To remove directories.
 clean-local:
-	rm -rf de fr debug parallel profile binaries normal*
+	rm -rf de fr debug parallel profile binaries normal* 


[google/integration] add x86_64-grtev3-linux-gnu target name (issue5718044)

2012-03-01 Thread Ollie Wild
Add an x86_64-grtev3-linux-gnu target.

For GRTE v2, we use the value of $with_sysroot to conditionally include spec
file changes.  This is inconsistent with what we do for other architectures
like ARM, and it's less flexible since (a) the feature machinery is really
designed to key off $target and (b) we're inferring fundamental things from
incidentals.

This should make it easier to add further GRTE-specific features (patches
forthcoming) and has the added bonus of allowing us to differentiate between
native bootstrap test failures and Crosstool build failures.

I will be submitting this to the google/integration branch and integrating to
google/main and google/gcc-4_7.

Ollie


2012-03-01   Ollie Wild  a...@google.com

* contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail:
* gcc/config.gcc:
* gcc/config/i386/linux.h:
* gcc/config/i386/linux64.h:
* gcc/config/linux-grtev3.h:

diff --git a/contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail 
b/contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail
new file mode 100644
index 000..388da93
--- /dev/null
+++ b/contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail
@@ -0,0 +1,73 @@
+#*** libstdc++ for unix/-m32:
+#*** libstdc++ for unix/-m64:
+# Both of these fail because of the stl debug patch which changes line numbers.
+FAIL: 23_containers/vector/requirements/dr438/assign_neg.cc  (test for errors, 
line 1225)
+FAIL: 23_containers/vector/requirements/dr438/assign_neg.cc (test for excess 
errors)
+FAIL: 23_containers/vector/requirements/dr438/constructor_1_neg.cc  (test for 
errors, line 1155)
+FAIL: 23_containers/vector/requirements/dr438/constructor_1_neg.cc (test for 
excess errors)
+FAIL: 23_containers/vector/requirements/dr438/constructor_2_neg.cc  (test for 
errors, line 1155)
+FAIL: 23_containers/vector/requirements/dr438/constructor_2_neg.cc (test for 
excess errors)
+FAIL: 23_containers/vector/requirements/dr438/insert_neg.cc  (test for errors, 
line 1266)
+FAIL: 23_containers/vector/requirements/dr438/insert_neg.cc (test for excess 
errors)
+
+# These tests fail in trunk in all configurations.
+FAIL: gcc.dg/cproj-fails-with-broken-glibc.c execution test
+XPASS: gcc.dg/inline_3.c (test for excess errors)
+XPASS: gcc.dg/inline_4.c (test for excess errors)
+XPASS: gcc.dg/unroll_2.c (test for excess errors)
+XPASS: gcc.dg/unroll_3.c (test for excess errors)
+XPASS: gcc.dg/unroll_4.c (test for excess errors)
+FAIL: libmudflap.c++/pass55-frag.cxx ( -O) execution test
+FAIL: gcc.c-torture/execute/vshuf-v2di.c execution,  -Os
+FAIL: gcc.c-torture/execute/vshuf-v8hi.c execution,  -Os
+FAIL: gcc.c-torture/execute/vshuf-v16qi.c execution,  -Os
+
+# These fail because we use non-standard 32-bit configuration.
+FAIL: gcc.target/i386/pr27827.c scan-assembler fmul[ \t]*%st
+FAIL: gcc.dg/pr52086.c (internal compiler error)
+FAIL: gcc.dg/pr52086.c (test for excess errors)
+
+# Failures in libitm.
+FAIL: libitm.c/stackundo.c (test for excess errors)
+UNRESOLVED: libitm.c/stackundo.c compilation failed to produce executable
+FAIL: libitm.c++/dropref.C (test for excess errors)
+UNRESOLVED: libitm.c++/dropref.C compilation failed to produce executable
+UNRESOLVED: libitm.c++/eh-1.C compilation failed to produce executable
+FAIL: libitm.c++/eh-1.C (test for excess errors)
+FAIL: libitm.c++/throwdown.C (test for excess errors)
+FAIL: libitm.c/cancel.c (test for excess errors)
+UNRESOLVED: libitm.c/cancel.c compilation failed to produce executable
+FAIL: libitm.c/clone-1.c (test for excess errors)
+UNRESOLVED: libitm.c/clone-1.c compilation failed to produce executable
+FAIL: libitm.c/dropref-2.c (test for excess errors)
+UNRESOLVED: libitm.c/dropref-2.c compilation failed to produce executable
+UNRESOLVED: libitm.c/dropref.c compilation failed to produce executable
+FAIL: libitm.c/dropref.c (test for excess errors)
+FAIL: libitm.c/memcpy-1.c (test for excess errors)
+UNRESOLVED: libitm.c/memcpy-1.c compilation failed to produce executable
+FAIL: libitm.c/memset-1.c (test for excess errors)
+UNRESOLVED: libitm.c/memset-1.c compilation failed to produce executable
+UNRESOLVED: libitm.c/notx.c compilation failed to produce executable
+FAIL: libitm.c/notx.c (test for excess errors)
+FAIL: libitm.c/reentrant.c (test for excess errors)
+UNRESOLVED: libitm.c/reentrant.c compilation failed to produce executable
+FAIL: libitm.c/simple-1.c (test for excess errors)
+UNRESOLVED: libitm.c/simple-1.c compilation failed to produce executable
+UNRESOLVED: libitm.c/simple-2.c compilation failed to produce executable
+FAIL: libitm.c/simple-2.c (test for excess errors)
+UNRESOLVED: libitm.c/txrelease.c compilation failed to produce executable
+FAIL: libitm.c/txrelease.c (test for excess errors)
+
+# These tests only fail when boehm-gc.c is enabled.
+FAIL: boehm-gc.c/thread_leak_test.c -O2 (test for excess errors)
+
+# These are flaky when tested in loaded machines (they exceed the timeout)
+flaky | FAIL: 

[google/4.6] Backport r184357 from trunk to fix validate_failures.py (issue5720047)

2012-03-01 Thread Doug Kwan
Hi Diego,

This is a backport from trunk to fix a problem in validate_failures.py
when testing a cross compiler.

-Doug

2012-03-01   Doug Kwan  dougk...@google.com

Backport r184357 from trunk
2012-02-17   Doug Kwan  dougk...@google.com

* contrib/testsuite-management/validate_failures.py
(GetMakefileValue): Check for cross compilers.

Index: contrib/testsuite-management/validate_failures.py
===
--- contrib/testsuite-management/validate_failures.py   (revision 184772)
+++ contrib/testsuite-management/validate_failures.py   (working copy)
@@ -146,7 +146,8 @@ def GetMakefileValue(makefile_name, value_name):
 def ValidBuildDirectory(builddir, target):
   if (not os.path.exists(builddir) or
   not os.path.exists('%s/Makefile' % builddir) or
-  not os.path.exists('%s/build-%s' % (builddir, target))):
+  (not os.path.exists('%s/build-%s' % (builddir, target)) and
+   not os.path.exists('%s/%s' % (builddir, target:
 return False
   return True
 

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


Re: [google/4.6]Backport r184370 from integration (issue5716054)

2012-03-01 Thread 關振德
I can wait until the merge is done.  Thanks.

-Doug

On Thu, Mar 1, 2012 at 12:17 PM, Diego Novillo dnovi...@google.com wrote:
 On 01/03/12 14:35 , Doug Kwan wrote:

 2012-03-01   Doug Kwandougk...@google.com

        Backport r184370 from integration branch.

        2012-02-17   Doug Kwandougk...@google.com

                * gcc/config.gcc (powerpc*-*-linux): Pull in GRTEv2 spec
                changes if target matches *-grtev2-*.
                * gcc/config/rs6000/linux64.h (GLIB_DYNAMIC_LINKER{32,64}):
 Add
                runtime root prefix to glibc's dynamic linker.
                * gcc/config/rs6000/linux-grtev2.h: New file.
                * gcc/config/rs6000/sysv4.h (GLIB_DYNAMIC_LINKER): Add
                runtime root prefix to glibc's dynamic linker.
                (LINUX_GRTE_EXTRA_SPECS): Define to be empty if no
 definition
                found.
                (SUBTARGET_EXTRA_SPECS): Include LINUX_GRTE_EXTRA_SPECS.


 This is fine, though I'm wondering if you could possibly wait to apply it.
  I'm currently testing a merge from gcc-4_6-branch to pick up the 4.6.3
 release.

 If you need it now, then apply it and let me know so I can re-start my
 testing.


 Thanks.  Diego.


Re: [google/4.6] Backport r184357 from trunk to fix validate_failures.py (issue5720047)

2012-03-01 Thread 關振德
If approved, this will be applied after Diego's 4.6.3 release merge
into Google's gcc-4_6 branch.

-Doug

On Thu, Mar 1, 2012 at 6:57 PM, Doug Kwan dougk...@google.com wrote:
 Hi Diego,

    This is a backport from trunk to fix a problem in validate_failures.py
 when testing a cross compiler.

 -Doug

 2012-03-01   Doug Kwan  dougk...@google.com

        Backport r184357 from trunk
        2012-02-17   Doug Kwan  dougk...@google.com

                * contrib/testsuite-management/validate_failures.py
                (GetMakefileValue): Check for cross compilers.

 Index: contrib/testsuite-management/validate_failures.py
 ===
 --- contrib/testsuite-management/validate_failures.py   (revision 184772)
 +++ contrib/testsuite-management/validate_failures.py   (working copy)
 @@ -146,7 +146,8 @@ def GetMakefileValue(makefile_name, value_name):
  def ValidBuildDirectory(builddir, target):
   if (not os.path.exists(builddir) or
       not os.path.exists('%s/Makefile' % builddir) or
 -      not os.path.exists('%s/build-%s' % (builddir, target))):
 +      (not os.path.exists('%s/build-%s' % (builddir, target)) and
 +       not os.path.exists('%s/%s' % (builddir, target:
     return False
   return True


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


Re: [PATCH, PR50335] Disable graphite loop flattening

2012-03-01 Thread Maxim Kuvyrkov
On 1/03/2012, at 11:42 PM, Richard Guenther wrote:
 On Thu, Mar 1, 2012 at 6:28 AM, Maxim Kuvyrkov ma...@codesourcery.com wrote:
 This patch disables graphite loop flattening optimization due to it being 
 effectively unmaintained.  To avoid users trying to use unsupported 
 optimization and reporting bugs, Sebastian Pop suggested to disable the 
 optimization.
 
 Testing on x86_64 is underway.  OK to apply provided no regressions?
 
 That cannot be enough, you need to adjust the testsuite as well.  And
 if it is broken,
 why not remove it.  Leaving unmaintained broken code in the repository is just
 a maintainance burden for no gain.
 
 So, please provide a complete removal patch (docs, making the option a
 dummy one, testcases, etc.)

OK.  The attached patch removes loop flattening optimization and updates 
documentation and testsuite.

Regtested on x86_64-linux-gnu with no regressions.

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



fsf-gcc-pr50335-2.ChangeLog
Description: Binary data


fsf-gcc-pr50335-2.patch
Description: Binary data


Re: [PATCH, 4.4, PR 52430] IPA-CP has to clone or leave alone externally_visible nodes

2012-03-01 Thread Maxim Kuvyrkov
On 2/03/2012, at 1:53 AM, Martin Jambor wrote:

 Hi,
 
 the following patch backports 4.5 behavior to 4.4 IPA-CP
 initialization when it decides which nodes need to be duplicated (we
 often say cloned, but cloning is an overloaded term in gcc) in order
 to modify them.  In 4.5, this is decided by a new predicate called
 cgraph_only_called_directly_p which checks both node-needed and
 node-local.externally_visible, whereas 4.4 looks only at the needed
 flag.
 
 As described in the PR, this wrecks havoc for ipcp_update_callgraph
 which is the stage of the old IPA-CP when it undoes its decisions
 which turned out not to be safe.
 
 Bootstrapped and tested on x86_64-linux, OK for the branch?
 
 
...
 Index: gcc/ipa-cp.c
 ===
 --- gcc/ipa-cp.c  (revision 184662)
 +++ gcc/ipa-cp.c  (working copy)
 @@ -508,7 +508,7 @@ ipcp_initialize_node_lattices (struct cg
 
   if (ipa_is_called_with_var_arguments (info))
 type = IPA_BOTTOM;
 -  else if (!node-needed)
 +  else if (!node-needed  !node-local.externally_visible)
 type = IPA_TOP;
   /* When cloning is allowed, we can assume that externally visible functions
  are not called.  We will compensate this by cloning later.  */

Because this is for a branch, I would be more conservative and avoid any new 
instances of IPA_TOP -- those that can be obtained from subsequent else-if 
clauses.  I.e.,

else if (!node-needed)
  type = !node-local.externally_visible ? IPA_TOP : IPA_BOTTOM;

Thanks,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



[v3] tweak traits for base classes

2012-03-01 Thread Benjamin De Kosnik

After discussions in Kona, some suggestions to refine this trait were
proposed, as attached. In addition, there is some documentation which
will be checked in later.

tested x86/linux

-benjamin2012-03-01  Michael Spertus  mike_sper...@symantec.com

	* include/tr2/type_traits (typelist): To __reflection_typelist.
	(first, rest, empty): Remove.

diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits
index 9c301b3..eb8c012 100644
--- a/libstdc++-v3/include/tr2/type_traits
+++ b/libstdc++-v3/include/tr2/type_traits
@@ -1,6 +1,6 @@
 // TR2 type_traits -*- C++ -*-
 
-// Copyright (C) 2011 Free Software Foundation, Inc.
+// Copyright (C) 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
@@ -53,60 +53,48 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*  Simple typelist. Compile-time list of types.
*/
   templatetypename... _Elements
-struct typelist;
+struct __reflection_typelist;
 
   /// Specialization for an empty typelist.
   template
-struct typelist
+struct __reflection_typelist
 {
-  typedef std::true_type 			empty;
+  typedef std::true_type	empty;
 };
 
   /// Partial specialization.
   templatetypename _First, typename... _Rest
-struct typelist_First, _Rest...
+struct __reflection_typelist_First, _Rest...
 {
-  typedef std::false_type 			empty;
+  typedef std::false_type	empty;
 
   struct first
   {
-	typedef _First type;
+	typedef _First		type;
   };
 
   struct rest
   {
-	typedef typelist_Rest... 		type;
+	typedef __reflection_typelist_Rest...			type;
   };
 };
 
   /// Sequence abstraction metafunctions for manipulating a typelist.
 
 
-  /// Return the first type in a typelist.
-  templatetypename _Tp
-struct first : public _Tp::first { };
-
-  /// Return the typelist minus the first type.
-  templatetypename _Tp
-struct rest : public _Tp::rest { };
-
-  /// Query to see if a typelist is empty.
-  templatetypename _Tp
-struct empty : public _Tp::empty { };
-
 
   /// Enumerate all the base classes of a class. Form of a typelist.
   templatetypename _Tp
 struct bases
 {
-  typedef typelist__bases(_Tp)... 	type;
+  typedef __reflection_typelist__bases(_Tp)...		type;
 };
 
   /// Enumerate all the direct base classes of a class. Form of a typelist.
   templatetypename _Tp
 struct direct_bases
 {
-  typedef typelist__direct_bases(_Tp)... 	type;
+  typedef __reflection_typelist__direct_bases(_Tp)...	type;
 };
 
   /// @} group metaprogramming


[v3] libstdc++/51785

2012-03-01 Thread Benjamin De Kosnik

as per the bugzilla log

tested x86/linux

-benjamin2012-03-01  Benjamin Kosnik  b...@redhat.com
Ramana Radhakrishnan ram...@gcc.gnu.org

	PR libstdc++/51785
	* acinclude.m4 (GLIBCXX_CHECK_STDIO_PROTO): New.
	* configure.ac: Call it.
	* configure: Regenerate.
	* config.h.in: Same.
	* config/os/gnu-linux/os_defines.h: Conditionally undefine
	_GLIBCXX_HAVE_GETS.
	* include/c_global/cstdio: Conditionally declare deprecated gets.
	* include/c_std/cstdio: Same.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index fe37a91..56711c0 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1809,6 +1809,35 @@ AC_DEFUN([GLIBCXX_CHECK_STDLIB_PROTO], [
 ])
 
 dnl
+dnl Check whether required C++ overloads are present in stdio.h.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_STDIO_PROTO], [
+
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+
+  AC_MSG_CHECKING([for gets declaration])
+  AC_CACHE_VAL(glibcxx_cv_gets, [
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+	  [#include stdio.h
+	   namespace test 
+	   {
+  using ::gets;
+	   }
+	])],
+	[glibcxx_cv_gets=yes],
+	[glibcxx_cv_gets=no]
+  )])
+
+  if test $glibcxx_cv_gets = yes; then
+AC_DEFINE(HAVE_GETS, 1, [Define if gets is available in stdio.h.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_gets)
+
+  AC_LANG_RESTORE
+])
+
+dnl
 dnl Check whether macros, etc are present for system_error
 dnl
 AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
diff --git a/libstdc++-v3/config/os/gnu-linux/os_defines.h b/libstdc++-v3/config/os/gnu-linux/os_defines.h
index c788cb0..c4aa305 100644
--- a/libstdc++-v3/config/os/gnu-linux/os_defines.h
+++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h
@@ -1,6 +1,6 @@
 // Specific definitions for GNU/Linux  -*- C++ -*-
 
-// Copyright (C) 2000, 2001, 2002, 2003, 2009, 2010
+// Copyright (C) 2000, 2001, 2002, 2003, 2009, 2010, 2012
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -39,4 +39,11 @@
 
 #include features.h
 
+// Provide a declaration for the possibly deprecated gets function, as
+// glibc 2.15 and later does not declare gets for ISO C11 when
+// __GNU_SOURCE is defined.
+#if __GLIBC_PREREQ(2,15)  defined(_GNU_SOURCE)
+# undef _GLIBCXX_HAVE_GETS
+#endif
+
 #endif
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 49de141..f04563e 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -136,6 +136,7 @@ GLIBCXX_ENABLE_WERROR([yes])
 # Checks for operating systems support that doesn't require linking.
 GLIBCXX_CHECK_MATH_PROTO
 GLIBCXX_CHECK_STDLIB_PROTO
+GLIBCXX_CHECK_STDIO_PROTO
 GLIBCXX_CHECK_SYSTEM_ERROR
 
 # For the streamoff typedef.
diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
index 049704d..d11743a 100644
--- a/libstdc++-v3/include/c_global/cstdio
+++ b/libstdc++-v3/include/c_global/cstdio
@@ -1,7 +1,7 @@
 // -*- C++ -*- forwarding header.
 
 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009, 2010
+// 2006, 2007, 2008, 2009, 2010, 2012
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -46,6 +46,10 @@
 #ifndef _GLIBCXX_CSTDIO
 #define _GLIBCXX_CSTDIO 1
 
+#ifndef _GLIBCXX_HAVE_GETS
+extern C extern char* gets (char* __s) __attribute__((deprecated));
+#endif
+
 // Get rid of those macros defined in stdio.h in lieu of real functions.
 #undef clearerr
 #undef fclose
@@ -67,7 +71,6 @@
 #undef ftell
 #undef fwrite
 #undef getc
-#undef getchar
 #undef gets
 #undef perror
 #undef printf
diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
index 510f599..1588fc9 100644
--- a/libstdc++-v3/include/c_std/cstdio
+++ b/libstdc++-v3/include/c_std/cstdio
@@ -1,7 +1,7 @@
 // -*- C++ -*- forwarding header.
 
 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2009, 2010  Free Software Foundation, Inc.
+// 2009, 2010, 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
@@ -45,6 +45,10 @@
 #include bits/c++config.h
 #include stdio.h
 
+#ifndef _GLIBCXX_HAVE_GETS
+extern C extern char* gets (char* __s) __attribute__((deprecated));
+#endif
+
 // Get rid of those macros defined in stdio.h in lieu of real functions.
 #undef clearerr
 #undef fclose