C++ PATCH for c++/52248 (ICE with -ftime-report and undefined label)

2012-02-17 Thread Jason Merrill
Here we can get to define_label from within poplevel, which results in 
recursive starting of TV_NAME_LOOKUP.  The obvious solution is to just 
use cond_start/stop in define_label.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit 4e0a90cdec5d3e1b29335eb8c63c6a6885e0f674
Author: Jason Merrill ja...@redhat.com
Date:   Thu Feb 16 13:45:29 2012 -0800

	PR c++/52248
	* decl.c (define_label): Use timevar_cond_start/stop.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f0ba181..28a7277 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2947,9 +2947,9 @@ tree
 define_label (location_t location, tree name)
 {
   tree ret;
-  timevar_start (TV_NAME_LOOKUP);
+  bool running = timevar_cond_start (TV_NAME_LOOKUP);
   ret = define_label_1 (location, name);
-  timevar_stop (TV_NAME_LOOKUP);
+  timevar_cond_stop (TV_NAME_LOOKUP, running);
   return ret;
 }
 
diff --git a/gcc/testsuite/g++.dg/ext/timevar1.C b/gcc/testsuite/g++.dg/ext/timevar1.C
new file mode 100644
index 000..0d2d3f5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/timevar1.C
@@ -0,0 +1,12 @@
+// PR c++/52248
+// { dg-options -ftime-report }
+// { dg-prune-output wall }
+// { dg-prune-output times }
+// { dg-prune-output TOTAL }
+// { dg-prune-output checks }
+
+void
+foo ()
+{
+  goto lab;			// { dg-error not defined }
+}


Re: [PATCH 2/9] [doloop] Correct extracting loop exit condition

2012-02-17 Thread Richard Sandiford
Andrey Belevantsev a...@ispras.ru writes:
 On 30.09.2011 19:21, Roman Zhuykov wrote:
 2011/7/22 Richard Sandifordrichard.sandif...@linaro.org:
 That's pre-approved (independently of the other patches) if it works.
 ...
 Changed like the following. Will commit if no objections after a couple of 
 days.

 We forgot to commit this patch back in September, is it fine to commit at 
 this stage?

Probably a bit late now, sorry.  (A bit like my reply.)

Richard


Re: obvious(?) typo in libstdc++-v3/src/c++98/locale.cc

2012-02-17 Thread Jonathan Wakely
On 15 February 2012 20:09, DJ Delorie wrote:

 The typo is obvious, but whether or not the wrapped code still works
 isn't (to me).

        * src/c++98/locale.cc (locale::facet::_S_get_c_locale): Fix typo.

I must have looked at that code dozens of times and never seen it!  :-\

I wonder if that's the cause of occasional locale-related segfaults
that get reported, such as:
http://gcc.gnu.org/ml/gcc-help/2011-06/msg00114.html
I can't find other right now, but I know I've looked through that file
a few times when mysterious crashes have been reproted.

We might want to consider applying to all open branches after it's
been on trunk for a while.


[google/main] Check for cross-compilers in validate_failures.py (issue5674087)

2012-02-17 Thread Doug Kwan
Hi Diego,

This patch fixes a problem of the validate_failures.py script that
it rejects cross compilers.  I have tested it by running the script
in the build directory of gcc configure for arm-unknown-linux-gnueabi.
I also tested it on a native compiler for x86.  This should go to both
google/main and trunk.

-Doug

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

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

Index: contrib/testsuite-management/validate_failures.py
===
--- contrib/testsuite-management/validate_failures.py   (revision 184327)
+++ 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/5674087


[Patch, Fortran, committed] Fix various misspellings

2012-02-17 Thread Tobias Burnus
I committed (Rev. 184331) the attached patch as obvious. Thanks to all 
translators at translationproject.org for their work - and in particular 
to Roland, who reported all the issues below.


See also PR 52274 for remaining translation-related issues.

 * * *

General GCC status: 0 P1, 64 P2, 12 P3 = 76 serious regressions. 62 P4 
and 53 P5. (Some of the P3 regressions have P1 priority.)


 * * *

Pending commits:

* OPTIONAL related patches by Mikael. Approved but not committed:
http://gcc.gnu.org/ml/fortran/2012-02/msg00062.html
http://gcc.gnu.org/ml/fortran/2012-02/msg00061.html

Review pending:

* -Wrealloc-lhs(-all)
http://gcc.gnu.org/ml/fortran/2012-02/msg00071.html

RFC patch:

* Janne's libgfortran patch: RFC: Shared vtables, constification
http://gcc.gnu.org/ml/fortran/2012-02/msg00067.html

Are there other patches, which have been posted (for 4.6, 4.7 or 4.8) 
but forgotten?


Tobias
2012-02-17  Tobias Burnus  bur...@net-b.de
	Roland Stigge  sti...@antcom.de

	PR translation/52232
	PR translation/52234
	PR translation/52245
	PR translation/52246
	PR translation/52262
	PR translation/52273
	* io.c (gfc_match_open): Fix typo.
	* interface.c (compare_actual_formal): Ditto.
	* lang.opt (freal-4-real-8, freal-4-real-16, freal-8-real-16): Ditto.
	* match.c (alloc_opt_list, gfc_match_nullify): Ditto.
	* check.c (gfc_check_associated, gfc_check_null): Ditto.

2012-02-17  Tobias Burnus  bur...@net-b.de

	PR translation/52232
	PR translation/52234
	PR translation/52245
	PR translation/52246
	PR translation/52262
	PR translation/52273
	* gfortran.dg/coarray_22.f90: Update dg-error.
	* gfortran.dg/allocate_alloc_opt_4.f90: Ditto.

Index: gcc/fortran/io.c
===
--- gcc/fortran/io.c	(Revision 184327)
+++ gcc/fortran/io.c	(Arbeitskopie)
@@ -2016,7 +2016,7 @@ gfc_match_open (void)
   /* Checks on the ROUND specifier.  */
   if (open-round)
 {
-  if (gfc_notify_std (GFC_STD_F2003, Fortran F2003: ROUND= at %C 
+  if (gfc_notify_std (GFC_STD_F2003, Fortran 2003: ROUND= at %C 
 	  not allowed in Fortran 95) == FAILURE)
   goto cleanup;
 
Index: gcc/fortran/interface.c
===
--- gcc/fortran/interface.c	(Revision 184327)
+++ gcc/fortran/interface.c	(Arbeitskopie)
@@ -2305,7 +2305,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gf
 	 a-expr-ts.type == BT_CHARACTER)
 	{
 	  if (where)
-	gfc_error (Actual argument argument at %L to allocatable or 
+	gfc_error (Actual argument at %L to allocatable or 
 		   pointer dummy argument '%s' must have a deferred 
 		   length type parameter if and only if the dummy has one,
 		   a-expr-where, f-sym-name);
@@ -2429,7 +2429,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gf
 	{
 	  if (where)
 	gfc_error (Coindexed ASYNCHRONOUS or VOLATILE actual argument at 
-		   at %L requires that dummy %s' has neither 
+		   at %L requires that dummy '%s' has neither 
 		   ASYNCHRONOUS nor VOLATILE, a-expr-where,
 		   f-sym-name);
 	  return 0;
Index: gcc/fortran/lang.opt
===
--- gcc/fortran/lang.opt	(Revision 184327)
+++ gcc/fortran/lang.opt	(Arbeitskopie)
@@ -500,7 +508,7 @@ Enable range checking during compilation
 
 freal-4-real-8
 Fortran RejectNegative
-Interpret any REAl(4) as a REAL(8)
+Interpret any REAL(4) as a REAL(8)
 
 freal-4-real-10
 Fortran RejectNegative
@@ -508,7 +516,7 @@ Interpret any REAL(4) as a REAL(10)
 
 freal-4-real-16
 Fortran RejectNegative
-Interpret any REAL(4) as a REAl(16)
+Interpret any REAL(4) as a REAL(16)
 
 freal-8-real-4
 Fortran RejectNegative
@@ -520,7 +528,7 @@ Interpret any REAL(8) as a REAL(10)
 
 freal-8-real-16
 Fortran RejectNegative
-Interpret any REAL(8) as a REAl(16)
+Interpret any REAL(8) as a REAL(16)
 
 frealloc-lhs
 Fortran
Index: gcc/fortran/match.c
===
--- gcc/fortran/match.c	(Revision 184327)
+++ gcc/fortran/match.c	(Arbeitskopie)
@@ -3661,7 +3661,7 @@ alloc_opt_list:
 
 	  if (head-next
 	   gfc_notify_std (GFC_STD_F2008, Fortran 2008: SOURCE tag at %L
-  with more than a single allocate objects,
+  with more than a single allocate object,
  tmp-where) == FAILURE)
 	goto cleanup;
 
@@ -3787,7 +3787,7 @@ gfc_match_nullify (void)
   /* F2008, C1242.  */
   if (gfc_is_coindexed (p))
 	{
-	  gfc_error (Pointer object at %C shall not be conindexed);
+	  gfc_error (Pointer object at %C shall not be coindexed);
 	  goto cleanup;
 	}
 
Index: gcc/fortran/check.c
===
--- gcc/fortran/check.c	(Revision 184327)
+++ gcc/fortran/check.c	(Arbeitskopie)
@@ -908,7 +908,7 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr
   if (attr1.pointer  gfc_is_coindexed (pointer))
 {
   gfc_error ('%s' argument of '%s' intrinsic at %L 

[Patch, Fortran, committed] Fix some typos in .texi

2012-02-17 Thread Tobias Burnus

Committed as Rev. 184332.

Tobias
Index: gfortran.texi
===
--- gfortran.texi	(revision 184330)
+++ gfortran.texi	(working copy)
@@ -795,7 +795,7 @@ override type-bound procedures or to have deferred
 
 @item Polymorphic entities (``@code{CLASS}'') for derived types -- including
 @code{SAME_TYPE_AS}, @code{EXTENDS_TYPE_OF} and @code{SELECT TYPE}.
-Note that unlimited polymophism is currently not supported.
+Note that unlimited polymorphism is currently not supported.
 
 @item Generic interface names, which have the same name as derived types,
 are now supported. This allows one to write constructor functions.  Note
@@ -835,7 +835,7 @@ association status not the value of the pointer ta
 @item Intrinsics @code{command_argument_count}, @code{get_command},
 @code{get_command_argument}, and @code{get_environment_variable}.
 
-@item Support for unicode characters (ISO 10646) and UTF-8, including
+@item Support for Unicode characters (ISO 10646) and UTF-8, including
 the @code{SELECTED_CHAR_KIND} and @code{NEW_LINE} intrinsic functions.
 
 @item Support for binary, octal and hexadecimal (BOZ) constants in the
@@ -1521,7 +1521,7 @@ of the @code{READ} statement, and the output item
 
 GNU Fortran accepts real literal constants with an exponent-letter
 of @code{Q}, for example, @code{1.23Q45}.  The constant is interpreted
-as a @code{REAL(16)} entity on targets that suppports this type.  If
+as a @code{REAL(16)} entity on targets that supports this type.  If
 the target does not support @code{REAL(16)} but has a @code{REAL(10)}
 type, then the real-literal-constant will be interpreted as a
 @code{REAL(10)} entity.  In the absence of @code{REAL(16)} and
Index: ChangeLog
===
--- ChangeLog	(revision 184331)
+++ ChangeLog	(working copy)
@@ -1,4 +1,10 @@
 2012-02-17  Tobias Burnus  bur...@net-b.de
+
+	* gfortran.texi (Status): Fix typos.
+	* invoke.texi (ffixed-form, fstack-arrays): Spell Fortran with
+	a majuscule.
+
+2012-02-17  Tobias Burnus  bur...@net-b.de
 	Roland Stigge  sti...@antcom.de
 
 	PR translation/52232
Index: invoke.texi
===
--- invoke.texi	(revision 184330)
+++ invoke.texi	(working copy)
@@ -204,7 +204,7 @@ accepted by the compiler:
 @itemx -ffixed-form
 @opindex @code{ffree-form}
 @opindex @code{fno-fixed-form}
-@cindex options, fortran dialect
+@cindex options, Fortran dialect
 @cindex file format, free
 @cindex file format, fixed
 Specify the layout used by the source file.  The free form layout
@@ -1425,7 +1425,7 @@ The default value for @var{n} is 32768.
 
 @item -fstack-arrays
 @opindex @code{fstack-arrays}
-Adding this option will make the fortran compiler put all local arrays,
+Adding this option will make the Fortran compiler put all local arrays,
 even those of unknown size onto stack memory.  If your program uses very
 large local arrays it is possible that you will have to extend your runtime
 limits for stack memory on some operating systems. This flag is enabled


Re: [Patch, Fortran, committed] Fix some typos in .texi

2012-02-17 Thread Tobias Burnus

On 02/17/2012 12:15 PM, Tobias Burnus wrote:

Committed as Rev. 184332.


I just saw that one line didn't only have a typo but also a grammar bug. 
Fix that one now as attached. (Rev. 184333.)


Tobias
Index: gfortran.texi
===
--- gfortran.texi	(revision 184332)
+++ gfortran.texi	(working copy)
@@ -1521,7 +1521,7 @@ of the @code{READ} statement, and the output item
 
 GNU Fortran accepts real literal constants with an exponent-letter
 of @code{Q}, for example, @code{1.23Q45}.  The constant is interpreted
-as a @code{REAL(16)} entity on targets that supports this type.  If
+as a @code{REAL(16)} entity on targets that support this type.  If
 the target does not support @code{REAL(16)} but has a @code{REAL(10)}
 type, then the real-literal-constant will be interpreted as a
 @code{REAL(10)} entity.  In the absence of @code{REAL(16)} and
Index: ChangeLog
===
--- ChangeLog	(revision 184332)
+++ ChangeLog	(working copy)
@@ -1,5 +1,9 @@
 2012-02-17  Tobias Burnus  bur...@net-b.de
 
+	* gfortran.texi (Q exponent-letter): Fix grammar.
+
+2012-02-17  Tobias Burnus  bur...@net-b.de
+
 	* gfortran.texi (Status): Fix typos.
 	* invoke.texi (ffixed-form, fstack-arrays): Spell Fortran with
 	a majuscule.


Re: [Patch, libfortran] RFC: Shared vtables, constification

2012-02-17 Thread Janne Blomqvist
On Mon, Feb 13, 2012 at 23:04, Steven Bosscher stevenb@gmail.com wrote:
 On Mon, Feb 13, 2012 at 7:20 PM, Janne Blomqvist
 blomqvist.ja...@gmail.com wrote:
 Hi,

 the attached patch changes the low-level libgfortran IO dispatching
 mechanism to use shared vtables for each stream type, instead of all
 the function pointers being replicated for each unit. This is similar
 to e.g. how the C++ frontend implements vtables. The benefits are:

 - Slightly smaller heap memory overhead for each unit as only the
 vtable pointer needs to be stored, and slightly faster unit
 initialization as only the vtable pointer needs to be setup instead of
 all the function pointers in the stream struct.

 - Looking at unix.o with readelf, one sees

 Relocation section '.rela.data.rel.ro.local.mem_vtable' at offset
 0x15550 contains 8 entries:

 and similarly for the other vtables; according to
 http://www.airs.com/blog/archives/189 this means that after relocation
 the page where this data resides may be marked read-only.

 The downside is that the sizes of the .text and .data sections are
 increased. Before:

   text    data     bss     dec     hex filename
 1116991    6664     592 1124247  112797
 ./x86_64-unknown-linux-gnu/libgfortran/.libs/libgfortran.so

 After:

   text    data     bss     dec     hex filename
 1117487    6936     592 1125015  112a97
 ./x86_64-unknown-linux-gnu/libgfortran/.libs/libgfortran.so


 The data section increase is due to the vtables, the text increase is,
 I guess, due to the extra pointer dereference when calling the IO
 functions.

 Regtested on x86_64-unknown-linux-gnu, Ok for trunk, or 4.8?

 Certainly not for trunk at this stage.

Fair enough.

 For 4.8: So the trade-off is between faster initialization and smaller
 heap vs. fewer pointer dereferences?

From a performance perspective, yes. Also, a multi-threaded program
may benefit slightly from fewer cacheline ping-pongs due to the
read-only vtables being separated from the RW data in the stream
struct. That being said, while there are a few performance issues
lurking here and there in libgfortran, virtual function dispatch isn't
one of them. I think you'd be hard pressed to come up with a benchmark
where you could see a difference.

The other advantage is that by putting the vtables in read-only pages,
the chance of a buggy program getting a SIGSEGV instead of corrupting
the library state is slightly increased.

 Does this patch fix an actual
 problem? Does it bring a killer feature?

No, it's certainly not a killer feature. In general, considering the
maturity of gfortran, I think it's unreasonable to expect that a
bordering-on-trivial patch would bring a killer feature.

The patch came about as a small experiment I did, and as I considered
the result an overall improvement (even if admittedly quite a minor
one), I added a ChangeLog and submitted it.

-- 
Janne Blomqvist


[patch stor-layout]: Fix PR 52238 - -mms-bitfields: __attribute__ ((aligned (n))) ignored for struct members

2012-02-17 Thread Kai Tietz
Hi,

this patch fixes old regression about ms-bitfields structure layout.
This patch was
verified by VLC community and libAV people (as to see in bug-report).
The result of
the structure-layout was also compared to VC's 32-bit and 64-bit
result by VLC people.

ChangeLog

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

PR target/52238
* stor-layout.c (place_field): Handle desired_align for
ms-bitfields, too.

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

* gcc.dg/bf-ms-layout-3.c: New testcase.

Tested for i686-w64-mingw32, x86_64-w64-mingw32, i686-pc-cygwin.  Ok for apply?

Regards,
Kai

Index: gcc/gcc/stor-layout.c
===
--- gcc.orig/gcc/stor-layout.c
+++ gcc/gcc/stor-layout.c
@@ -1141,15 +1141,14 @@ place_field (record_layout_info rli, tre
 }

   /* Does this field automatically have alignment it needs by virtue
- of the fields that precede it and the record's own alignment?
- We already align ms_struct fields, so don't re-align them.  */
-  if (known_align  desired_align
-   !targetm.ms_bitfield_layout_p (rli-t))
+ of the fields that precede it and the record's own alignment?  */
+  if (known_align  desired_align)
 {
   /* No, we need to skip space before this field.
 Bump the cumulative size to multiple of field alignment.  */

-  if (DECL_SOURCE_LOCATION (field) != BUILTINS_LOCATION)
+  if (!targetm.ms_bitfield_layout_p (rli-t)
+   DECL_SOURCE_LOCATION (field) != BUILTINS_LOCATION)
warning (OPT_Wpadded, padding struct to align %q+D, field);

   /* If the alignment is still within offset_align, just align
@@ -1171,7 +1170,8 @@ place_field (record_layout_info rli, tre

   if (! TREE_CONSTANT (rli-offset))
rli-offset_align = desired_align;
-
+  if (targetm.ms_bitfield_layout_p (rli-t))
+   rli-prev_field = NULL;
 }

   /* Handle compatibility with PCC.  Note that if the record has any
Index: gcc/gcc/testsuite/gcc.dg/bf-ms-layout-3.c
===
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/bf-ms-layout-3.c
@@ -0,0 +1,47 @@
+/* Test for MS bitfield layout */
+/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin*
i?86-*-darwin* } } */
+/* { dg-options -mms-bitfields } */
+
+extern void abort();
+
+struct {
+char a;
+char b __attribute__ ((aligned (16)));
+} s1;
+
+struct {
+  char a;
+  char b;
+} s2;
+
+struct {
+  char a : 6;
+  char b __attribute__ ((aligned (16)));
+} s3;
+
+struct {
+  char a : 6;
+  char b __attribute__ ((aligned (2)));
+} s4;
+
+struct {
+  char a : 6;
+  char b __attribute__ ((aligned (1)));
+} s5;
+
+__PTRDIFF_TYPE__ offs (const void *a, const void *b)
+{
+  return (__PTRDIFF_TYPE__) ((const char*)a  - (const char*)b);
+}
+
+int main()
+{
+  if (offs (s1.b, s1) != 16
+  || offs (s2.b, s2) != 1
+  || offs (s3.b, s3) != 16
+  || offs (s4.b, s4) != 2
+  || offs (s5.b, s5) != 1)
+abort ();
+  return 0;
+}
+


Re: [google/main] Check for cross-compilers in validate_failures.py (issue5674087)

2012-02-17 Thread Diego Novillo

On 17/02/12 05:49 , Doug Kwan wrote:


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

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


OK.  Thanks.


Diego.


Re: [google/integration] Add support for powerpc64-grtev2-linux-gnu (issue5659050)

2012-02-17 Thread Diego Novillo

On 16/02/12 20:00 , Doug Kwan (關振德) wrote:

Hi Diego  Ollie,

 Could you guys take a look?

-Doug

On Mon, Feb 13, 2012 at 6:41 PM, Doug Kwandougk...@google.com  wrote:

Hi,

This patch adds support for powerpc*-grtev2-linux-gnu.  The changes
include:

1. Relocating the dynamic linker using a run-time root prefix.
2. Using different library setting in static linking.

This is tested by building PowerPC64 and PowerPC toolchains and ran
some tests with the resulting toolchain.

This is used by Google and is not meant to be sent to trunk.

-Doug

2012-02-13   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.


OK for google/integration.  Thanks.


Diego.


Re: [Patch, Fortran, committed] Fix various misspellings

2012-02-17 Thread Tobias Burnus
I missed one issue because it was in the bug summary while the bug 
description (also in the same line) mentioned a different bug. The 
attached patch now fixes also the bug of the summary.

(Rev. 184334.)

Note to self: Read bug descriptions more carefully and also read the 
summary line.


Tobias
Index: ChangeLog
===
--- ChangeLog	(revision 184333)
+++ ChangeLog	(working copy)
@@ -1,5 +1,11 @@
 2012-02-17  Tobias Burnus  bur...@net-b.de
+	Roland Stigge  sti...@antcom.de
 
+	PR translation/52273
+	* interface.c (compare_actual_formal): Fix typo at at.
+
+2012-02-17  Tobias Burnus  bur...@net-b.de
+
 	* gfortran.texi (Q exponent-letter): Fix grammar.
 
 2012-02-17  Tobias Burnus  bur...@net-b.de
Index: interface.c
===
--- interface.c	(revision 184333)
+++ interface.c	(working copy)
@@ -2429,7 +2429,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gf
 	{
 	  if (where)
 	gfc_error (Coindexed ASYNCHRONOUS or VOLATILE actual argument at 
-		   at %L requires that dummy '%s' has neither 
+		   %L requires that dummy '%s' has neither 
 		   ASYNCHRONOUS nor VOLATILE, a-expr-where,
 		   f-sym-name);
 	  return 0;


Re: [v3] Disable gthreads on Solaris 8/9 (PR libstdc++/52189)

2012-02-17 Thread Rainer Orth
Jonathan Wakely jwakely@gmail.com writes:

 For the HTML docs, just check in without that bit in the ChangeLog.
 Regenerating the HTML changes almost every page because links between
 sections get randomly-generated anchor names, so I'll just do an
 update for doc/html/* once your change is checked in.

Ok, I see.

I've checked in the following after re-testing as follows:

* i386-pc-solaris2.10 bootstrap, gthreads remains enabled, abi_check
  results clean with regenerated baselines

* i386-pc-solaris2.9 C++-only bootstrap with --enable-libstdcxx-threads,
  gthreads enabled with expected warning, abi_check results show
  additional symbols with versioning breakage

* i386-pc-solaris2.8 C++-only bootstrap, gthreads disabled as expected,
  abi_check results clean with regenerated baselines.

Thanks.
Rainer


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

PR libstdc++/52189
* acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Handle
--enable-libstdcxx-threads.
Disable on Solaris 8/9 with symbol versioning.
* configure.ac (GLIBCXX_CHECK_GTHREADS): Move after
GLIBCXX_ENABLE_SYMVERS.
* configure: Regenerate.
* doc/xml/manual/configure.xml (--enable-libstdcxx-threads): Explain.

# HG changeset patch
# Parent f44555017ca294fa283c4c114208438a87f249c7
Disable gthreads on Solaris 8/9 (PR libstdc++/52189)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3325,7 +3325,14 @@ dnl Check if gthread implementation defi
 dnl required by the c++0x thread library.  Conforming gthread
 dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
 dnl
+dnl GLIBCXX_ENABLE_SYMVERS must be done before this.
+dnl
 AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
+  GLIBCXX_ENABLE(libstdcxx-threads,auto,,[enable C++11 threads support])
+
+  if test x$enable_libstdcxx_threads = xauto || 
+ test x$enable_libstdcxx_threads = xyes; then
+
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
 
@@ -3364,7 +3371,28 @@ AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
   #ifndef __GTHREADS_CXX0X
   #error
   #endif
-], [ac_has_gthreads=yes], [ac_has_gthreads=no])
+], [case $target_os in
+	  # gthreads support breaks symbol versioning on Solaris 8/9 (PR
+	  # libstdc++/52189).
+  solaris2.[[89]]*)
+	if test x$enable_symvers = xno; then
+	  ac_has_gthreads=yes
+	elif test x$enable_libstdcxx_threads = xyes; then
+	  AC_MSG_WARN([You have requested C++11 threads support, but])
+	  AC_MSG_WARN([this breaks symbol versioning.])
+	  ac_has_gthreads=yes
+	else
+	  ac_has_gthreads=no
+	fi
+	;;
+	  *)
+	ac_has_gthreads=yes
+	;;
+esac],
+   [ac_has_gthreads=no])
+  else
+ac_has_gthreads=no
+  fi
 
   AC_MSG_RESULT([$ac_has_gthreads])
 
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -164,9 +164,6 @@ GLIBCXX_CHECK_GETTIMEOFDAY
 # NB: The default is [no], because otherwise it requires linking.
 GLIBCXX_ENABLE_LIBSTDCXX_TIME([no])
 
-# For gthread support
-GLIBCXX_CHECK_GTHREADS
-
 AC_LC_MESSAGES
 
 # For hardware_concurrency
@@ -335,6 +332,9 @@ GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT,
 # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
 GLIBCXX_CONFIGURE_TESTSUITE
 
+# For gthread support.  Depends on GLIBCXX_ENABLE_SYMVERS.
+GLIBCXX_CHECK_GTHREADS
+
 # Define documentation rules conditionally.
 
 # See if makeinfo has been installed and is modern enough
diff --git a/libstdc++-v3/doc/xml/manual/configure.xml b/libstdc++-v3/doc/xml/manual/configure.xml
--- a/libstdc++-v3/doc/xml/manual/configure.xml
+++ b/libstdc++-v3/doc/xml/manual/configure.xml
@@ -161,6 +161,13 @@
  /para
  /listitem/varlistentry
 
+ varlistentrytermcode--enable-libstdcxx-threads/code/term
+ listitemparaEnable C++11 threads support.  If not explicitly specified,
+the  configure process enables it if possible.  It defaults to 'off'
+	on Solaris 8 and 9, where it would break symbol versioning.   This
+	option can change the library ABI.
+ /para
+ /listitem/varlistentry
 
  varlistentrytermcode--enable-libstdcxx-time/code/term
  listitemparaThis is an abbreviated form of

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


[PATCH] Fix (X C1) | C2 folding (PR tree-optimization/52286)

2012-02-17 Thread Jakub Jelinek
Hi!

The following testcase is miscompiled (by CCP, or, if -fno-tree-ccp,
by VRP), because the (X  C1) | C2 folding changes the C1 constant
into an integer constant with most significant bit set, but not
sign-extended into the double_int.  Fixed by using double_int_to_tree
which extends it properly, instead of build_int_cst_wide.
Instead of creating a double_int from the hi3/lo3 pair I've changed
the code to actually work on double_ints.

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

2012-02-17  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/52286
* fold-const.c (fold_binary_loc): For (X  C1) | C2
optimization use double_int_to_tree instead of build_int_cst_wide,
rewrite to use double_int vars.

* gcc.c-torture/execute/pr52286.c: New test.

--- gcc/fold-const.c.jj 2012-02-16 20:04:34.0 +0100
+++ gcc/fold-const.c2012-02-17 12:05:46.559700551 +0100
@@ -10959,66 +10959,50 @@ fold_binary_loc (location_t loc,
   TREE_CODE (arg1) == INTEGER_CST
   TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
{
- unsigned HOST_WIDE_INT hi1, lo1, hi2, lo2, hi3, lo3, mlo, mhi;
+ double_int c1, c2, c3, msk;
  int width = TYPE_PRECISION (type), w;
- hi1 = TREE_INT_CST_HIGH (TREE_OPERAND (arg0, 1));
- lo1 = TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1));
- hi2 = TREE_INT_CST_HIGH (arg1);
- lo2 = TREE_INT_CST_LOW (arg1);
+ c1 = tree_to_double_int (TREE_OPERAND (arg0, 1));
+ c2 = tree_to_double_int (arg1);
 
  /* If (C1C2) == C1, then (XC1)|C2 becomes (X,C2).  */
- if ((hi1  hi2) == hi1  (lo1  lo2) == lo1)
+ if (double_int_equal_p (double_int_and (c1, c2), c1))
return omit_one_operand_loc (loc, type, arg1,
-TREE_OPERAND (arg0, 0));
+TREE_OPERAND (arg0, 0));
 
- if (width  HOST_BITS_PER_WIDE_INT)
-   {
- mhi = (unsigned HOST_WIDE_INT) -1
-(2 * HOST_BITS_PER_WIDE_INT - width);
- mlo = -1;
-   }
- else
-   {
- mhi = 0;
- mlo = (unsigned HOST_WIDE_INT) -1
-(HOST_BITS_PER_WIDE_INT - width);
-   }
+ msk = double_int_mask (width);
 
  /* If (C1|C2) == ~0 then (XC1)|C2 becomes X|C2.  */
- if ((~(hi1 | hi2)  mhi) == 0  (~(lo1 | lo2)  mlo) == 0)
+ if (double_int_zero_p (double_int_and_not (msk,
+double_int_ior (c1, c2
return fold_build2_loc (loc, BIT_IOR_EXPR, type,
-   TREE_OPERAND (arg0, 0), arg1);
+   TREE_OPERAND (arg0, 0), arg1);
 
  /* Minimize the number of bits set in C1, i.e. C1 := C1  ~C2,
 unless (C1  ~C2) | (C2  C3) for some C3 is a mask of some
 mode which allows further optimizations.  */
- hi1 = mhi;
- lo1 = mlo;
- hi2 = mhi;
- lo2 = mlo;
- hi3 = hi1  ~hi2;
- lo3 = lo1  ~lo2;
+ c1 = double_int_and (c1, msk);
+ c2 = double_int_and (c2, msk);
+ c3 = double_int_and_not (c1, c2);
  for (w = BITS_PER_UNIT;
   w = width  w = HOST_BITS_PER_WIDE_INT;
   w = 1)
{
  unsigned HOST_WIDE_INT mask
= (unsigned HOST_WIDE_INT) -1  (HOST_BITS_PER_WIDE_INT - w);
- if (((lo1 | lo2)  mask) == mask
-  (lo1  ~mask) == 0  hi1 == 0)
+ if (((c1.low | c2.low)  mask) == mask
+  (c1.low  ~mask) == 0  c1.high == 0)
{
- hi3 = 0;
- lo3 = mask;
+ c3 = uhwi_to_double_int (mask);
  break;
}
}
- if (hi3 != hi1 || lo3 != lo1)
+ if (!double_int_equal_p (c3, c1))
return fold_build2_loc (loc, BIT_IOR_EXPR, type,
-   fold_build2_loc (loc, BIT_AND_EXPR, type,
-TREE_OPERAND (arg0, 0),
-build_int_cst_wide (type,
-lo3, hi3)),
-   arg1);
+   fold_build2_loc (loc, BIT_AND_EXPR, type,
+TREE_OPERAND (arg0, 0),
+double_int_to_tree (type,
+c3)),
+   arg1);
}
 
   /* (X  Y) | Y is (X, Y).  */
--- gcc/testsuite/gcc.c-torture/execute/pr52286.c.jj2012-02-17 
12:09:41.131621700 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr52286.c   2012-02-17 
12:09:22.0 +0100
@@ -0,0 +1,14 @@

Re: [PATCH] Fix up --enable-initfini-array autodetection in configure (PR bootstrap/50237)

2012-02-17 Thread Rainer Orth
Rainer Orth r...@cebitec.uni-bielefeld.de writes:

 Richard Guenther richard.guent...@gmail.com writes:

 I'm not sure about the varasm.c change - it's definitely not a no-op
 (callback will be not set, and the flags will be different).  Certainly

 As I've demonstrated in my response to H.J., the effect with gas is none.

 the current code is inconsistent wrt the priority != DEFAULT_INIT_PRIORITY
 case, not sure why, but you don't make it consistent either because
 you don't change that case to SECTION_NOTYPE either.  I'd be fine

 I didn't find a need for that, but agree that the inconsistency is
 disturbing.  default_section_type_flags suggests that SECTION_NOTYPE
 should be set for .init_array and friends, but it's only used by
 get_named_section.

 with it with both calls using SECTION_NOTYPE, but would like to
 know what the callback difference is about.

 I don't think the callback is needed, which is effectively a

   printf (\t.section\t.init_array);

 Looking at it, this is e.g. wrong for Sun as on SPARC, which requires
 the section name to be in double quotes.

Here's the revised patch which consistently sets SECTION_NOTYPE.

Bootstrapped without regressions on i386-pc-solaris2.11 with gas/gld and
x86_64-unknown-linux-gnu, ok for mainline?

Rainer


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

PR target/50166
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Require gcc_SUN_LD_VERSION.
Define _start.
Remove -e 0 from $gcc_cv_ld invocation.
Only use __GLIBC_PREREQ if defined.
Enable on Solaris since Solaris 8 patch.
(gcc_SUN_LD_VERSION): New macro.
* configure.ac (ld_ver) *-*-solaris2*: Refer to
gcc_SUN_LD_VERSION for version number format.
* configure: Regenerate.
* varasm.c (get_elf_initfini_array_priority_section): Set
SECTION_NOTYPE for non-default priority.
Use get_section instead of get_unnamed_section to emit
.init_array/.fini_array with default priority.

# HG changeset patch
# Parent 4dc36b1ff03f2d688613f3edbf1d0724079888d3
Enable initfini array support on Solaris

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -1,4 +1,5 @@
-dnl Copyright (C) 2005, 2006, 2007, 2008, 2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012
+dnl Free Software Foundation, Inc.
 dnl
 dnl This file is part of GCC.
 dnl
@@ -370,7 +371,8 @@ fi
 fi])
 
 AC_DEFUN([gcc_AC_INITFINI_ARRAY],
-[AC_ARG_ENABLE(initfini-array,
+[AC_REQUIRE([gcc_SUN_LD_VERSION])dnl
+AC_ARG_ENABLE(initfini-array,
 	[  --enable-initfini-array	use .init_array/.fini_array sections],
 	[], [
 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
@@ -427,9 +429,11 @@ int (*fp) (void) __attribute__ ((section
 .balign 4
 .byte 'H', 'H', 'H', 'H'
 .text
+.globl _start
+_start:
 EOF
 	  if $gcc_cv_as -o conftest.o conftest.s  /dev/null 21 \
-	  $gcc_cv_ld -e 0 -o conftest conftest.o  /dev/null 21 \
+	  $gcc_cv_ld -o conftest conftest.o  /dev/null 21 \
 	  $gcc_cv_objdump -s -j .init_array conftest \
 		| grep   /dev/null 21 \
 	  $gcc_cv_objdump -s -j .fini_array conftest \
@@ -442,14 +446,38 @@ changequote([,])dnl
 	fi
 	AC_PREPROC_IFELSE([AC_LANG_SOURCE([
 #ifndef __ELF__
-#error Not an ELF OS
+# error Not an ELF OS
 #endif
 #include stdlib.h
-#if defined __GLIBC_PREREQ  __GLIBC_PREREQ (2, 4)
+#if defined __GLIBC_PREREQ
+# if __GLIBC_PREREQ (2, 4)
+# else
+#  error GLIBC 2.4 required
+# endif
 #else
-#error The C library not known to support .init_array/.fini_array
+# if defined __sun__  defined __svr4__
+   /* Solaris ld.so.1 supports .init_array/.fini_array since Solaris 8.  */
+# else
+#  error The C library not known to support .init_array/.fini_array
+# endif
 #endif
-])],, [gcc_cv_initfini_array=no]);;
+])],[
+case ${target} in
+  *-*-solaris2.8*)
+	# .init_array/.fini_array support was introduced in Solaris 8
+	# patches 109147-08 (sparc) and 109148-08 (x86).  Since ld.so.1 and
+	# ld are guaranteed to be updated in lockstep, we can check ld -V
+	# instead.  Unfortunately, proper ld version numbers were only
+	# introduced in rev. -14, so we check for that.
+  	if test $gcc_cv_sun_ld_vers_minor -lt 272; then
+	  gcc_cv_initfini_array=no
+	fi
+  ;;
+  *-*-solaris2.9* | *-*-solaris2.1[[0-9]]*)
+# .init_array/.fini_array support is present since Solaris 9 FCS.
+;;
+esac
+], [gcc_cv_initfini_array=no]);;
 esac
   else
 AC_MSG_CHECKING(cross compile... guessing)
@@ -569,6 +597,43 @@ if test $[$2] = yes; then
   $7
 fi])])
 
+dnl gcc_SUN_LD_VERSION
+dnl
+dnl Determines Sun linker version numbers, setting gcc_cv_sun_ld_vers to
+dnl the complete version number and gcc_cv_sun_ld_vers_{major, minor} to
+dnl the corresponding fields.
+dnl
+dnl ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version
+dnl numbers can be used in ld.so.1 feature 

[Ada] Better warning for failure to override an abstract operation in an instance

2012-02-17 Thread Arnaud Charlet
An operation declared in the private part of a generic package is overriding
in an instane only if it was overriding in the generic. If an instantiation
fails because a non-abstract type has a remaining abstract inherited operation
it may be because of a failure to override. This patch produces a warning in
this case, that clarifies the resulting error message.

compiling inst.ads must yield:

inst.ads:5:04: instantiation error at gen.ads:7
inst.ads:5:04: type must be declared abstract or Change overridden
inst.ads:5:04: Change has been inherited at gen.ads:5, instance at line 5
inst.ads:5:04: Change has been inherited from subprogram at line 4
inst.ads:5:04: warning: in instantiation at gen.ads:8
inst.ads:5:04: warning: private operation Change in generic unit does not
override any primitive operation of Der (RM 12.3 (18))

---
with P1; with Gen;
package Inst is
   type Act is abstract new P1.Root with null record;
   procedure Change (Obj : Act) is abstract;
   package Prob is new Gen (Act);
end Inst;
---
package P1 is
   type Root is abstract tagged null record;
end P1;
---
with P1;
generic
   type Ext is abstract new P1.Root with private;
package Gen is
   type Der is new Ext with private;
private
   type Der is new Ext with null record;
   procedure Change (Obj : Der);
end Gen;

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-02-17  Ed Schonberg  schonb...@adacore.com

* sem_ch6.adb (Is_Non_Overriding_Operation): Add warning if the
old operation is abstract, the relevant type is not abstract,
and the new subprogram fails to override.

Index: sem_ch6.adb
===
--- sem_ch6.adb (revision 184330)
+++ sem_ch6.adb (working copy)
@@ -188,9 +188,9 @@
   New_E  : Entity_Id) return Boolean;
--  Enforce the rule given in 12.3(18): a private operation in an instance
--  overrides an inherited operation only if the corresponding operation
-   --  was overriding in the generic. This can happen for primitive operations
-   --  of types derived (in the generic unit) from formal private or formal
-   --  derived types.
+   --  was overriding in the generic. This needs to be checked for primitive
+   --  operations of types derived (in the generic unit) from formal private
+   --  or formal derived types.
 
procedure Make_Inequality_Operator (S : Entity_Id);
--  Create the declaration for an inequality operator that is implicitly
@@ -7844,6 +7844,22 @@
--  If no match found, then the new subprogram does not
--  override in the generic (nor in the instance).
 
+   --  If the type in question is not abstract, and the subprogram
+   --  is, this will be an error if the new operation is in the
+   --  private part of the instance. Emit a warning now, which will
+   --  make the subsequent error message easier to understand.
+
+   if not Is_Abstract_Type (F_Typ)
+ and then Is_Abstract_Subprogram (Prev_E)
+ and then In_Private_Part (Current_Scope)
+   then
+  Error_Msg_Node_2 := F_Typ;
+  Error_Msg_NE
+(private operation in generic unit does not override  
+ any primitive operation of (RM 12.3 (18))?,
+ New_E, New_E);
+   end if;
+
return True;
 end;
  end if;


[wwwdocs,committed]: Update backends.html to match avr backend

2012-02-17 Thread Georg-Johann Lay
Committed the following to backends.html:

-m : The port *does* use define_constants
+b : Port does not use * ... notation for output template code
+g : Port does not define TARGET_ASM_FUNCTION_(PRO|EPI)LOGUE

Johann


Index: backends.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/backends.html,v
retrieving revision 1.42
diff -u -r1.42 backends.html
--- backends.html   5 Nov 2011 20:55:57 -   1.42
+++ backends.html   17 Feb 2012 14:41:34 -
@@ -68,7 +68,7 @@
 -+---
 alpha|  ?? Q   Cq  p g bda e
 arm  |  da  s
-avr  |L  FIl  c   m
+avr  |L  FIl  c  g b
 bfin |   F p g  da
 c4x  |  ??  N I BD   g  d  e
 c6x  |   S CB  p g bda


Re: [PATCH] Fix cgraph verification (PR middle-end/51929)

2012-02-17 Thread Jan Hubicka
 On Tue, Feb 14, 2012 at 11:12:31AM -0800, Jason Merrill wrote:
  On 02/10/2012 06:25 AM, Jakub Jelinek wrote:
 PR middle-end/51929
 * cgraphunit.c (verify_edge_corresponds_to_fndecl): If node is
 a same_body_alias, also test whether e-callee isn't a former
 or current clone of the decl this is a same body alias of.
  
  Do we want a similar change to the use of former_clone_of in
  cgraph_update_edges_for_call_stmt_node?  Maybe we should wrap the
 
 I don't think so.  new_call in that case is what we are changing the
 call to, and we should never change some call into a call to same body alias
 function, calls to same body alias functions should be just those that
 haven't been changed yet.

Yes, I think cgraph_update_edges_for_call_stmt_node is fine here.
I am not sure how long we will be able to maintain the edges sanity check.
It is useful, but as we start doing more and more involved redirections we
may need to disable it eventually.

Honza
 
  former_clone_of checking in a function to make that simpler.
 
   Jakub


Re: [PATCH][ARM] Improve use of conditional execution in thumb mode.

2012-02-17 Thread Andrew Stubbs

On 14/02/12 18:00, Andrew Stubbs wrote:

On Tue 14 Feb 2012 17:35:36 GMT, Richard Earnshaw wrote:

Bernds checked in a patch last year (or maybe even before that) to make
the selection of flags clobbered insns run very late (certainly after
condexec had run), so I'm not sure why you're not seeing this.


Hm, you mentioned some peepholes. Try removing them


Hmmm, it seems you're right. The machine reorg pass now takes care of
this. Well ... that was easy!

Here's a patch to remove the obsolete peepholes. I've confirmed it works
with the testcase.


Testing revealed that the new thumb_reorg code was not as thorough as 
the old peepholes at converting insns to 16-bit encodings.


This updated patch rewrites thumb_reorg to fix up all the missing cases, 
and adds a testcase to make sure it's all good. The parts that were in 
the old patch are unchanged.


I did initially try to insert the new cases into the old code, but the 
if conditions got way out of hand, and/or I ended up duplicating the 
active code. I've therefore recast the code to make it more scalable, 
but it boils down to the exact same thing.


I've got a full test run going again.

OK for 4.8, again?

Andrew
2012-02-17  Andrew Stubbs  a...@codesourcery.com

	gcc/
	* config/arm/arm.c (thumb2_reorg): Add complete support
	for 16-bit instructions.
	* config/arm/thumb2.md: Delete obsolete flag-clobbering peepholes.

	gcc/testsuite/
	* gcc.target/arm/thumb-16bit-ops.c: New file.
	* gcc.target/arm/thumb-ifcvt.c: New file.

---
 gcc/config/arm/arm.c   |  132 +++
 gcc/config/arm/thumb2.md   |  107 
 gcc/testsuite/gcc.target/arm/thumb-16bit-ops.c |  164 
 gcc/testsuite/gcc.target/arm/thumb-ifcvt.c |   19 +++
 4 files changed, 286 insertions(+), 136 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/arm/thumb-16bit-ops.c
 create mode 100644 gcc/testsuite/gcc.target/arm/thumb-ifcvt.c

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 0bded8d..c3a19e4 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -13246,47 +13246,121 @@ thumb2_reorg (void)
   FOR_BB_INSNS_REVERSE (bb, insn)
 	{
 	  if (NONJUMP_INSN_P (insn)
-	   !REGNO_REG_SET_P (live, CC_REGNUM))
+	   !REGNO_REG_SET_P (live, CC_REGNUM)
+	   GET_CODE (PATTERN (insn)) == SET)
 	{
+	  enum {SKIP, CONV, SWAP_CONV} action = SKIP;
 	  rtx pat = PATTERN (insn);
-	  if (GET_CODE (pat) == SET
-		   low_register_operand (XEXP (pat, 0), SImode)
-		   thumb_16bit_operator (XEXP (pat, 1), SImode)
-		   low_register_operand (XEXP (XEXP (pat, 1), 0), SImode)
-		   low_register_operand (XEXP (XEXP (pat, 1), 1), SImode))
+	  rtx dst = XEXP (pat, 0);
+	  rtx src = XEXP (pat, 1);
+	  rtx op0 = NULL_RTX, op1 = NULL_RTX;
+
+	  if (!OBJECT_P (src))
+		  op0 = XEXP (src, 0);
+
+	  if (BINARY_P (src))
+		  op1 = XEXP (src, 1);
+
+	  if (low_register_operand (dst, SImode))
 		{
-		  rtx dst = XEXP (pat, 0);
-		  rtx src = XEXP (pat, 1);
-		  rtx op0 = XEXP (src, 0);
-		  rtx op1 = (GET_RTX_CLASS (GET_CODE (src)) == RTX_COMM_ARITH
-			 ? XEXP (src, 1) : NULL);
-
-		  if (rtx_equal_p (dst, op0)
-		  || GET_CODE (src) == PLUS || GET_CODE (src) == MINUS)
+		  switch (GET_CODE (src))
 		{
-		  rtx ccreg = gen_rtx_REG (CCmode, CC_REGNUM);
-		  rtx clobber = gen_rtx_CLOBBER (VOIDmode, ccreg);
-		  rtvec vec = gen_rtvec (2, pat, clobber);
-
-		  PATTERN (insn) = gen_rtx_PARALLEL (VOIDmode, vec);
-		  INSN_CODE (insn) = -1;
+		case PLUS:
+		case MINUS:
+		  if (low_register_operand (op0, SImode))
+			{
+			  /* ADDS Rd,Rn,Rm  */
+			  if (low_register_operand (op1, SImode))
+			action = CONV;
+			  /* ADDS Rdn,#imm8  */
+			  else if (rtx_equal_p (dst, op0)
+CONST_INT_P (op1)
+IN_RANGE (INTVAL (op1), 0, 255))
+			action = CONV;
+			  /* ADDS Rd,Rn,#imm3  */
+			  else if (CONST_INT_P (op1)
+IN_RANGE (INTVAL (op1), 0, 7))
+			action = CONV;
+			}
+		  break;
+		case MULT:
+		  /* MULS Rdm,Rn,Rdm
+			 As an exception to the rule, this is only used
+			 when optimizing for size since MULS is slow on all
+			 known implementations.  */
+		  if (!optimize_function_for_size_p (cfun))
+			break;
+		  /* else fall through.  */
+		case AND:
+		case IOR:
+		case XOR:
+		  /* ANDS Rdn,Rm  */
+		  if (rtx_equal_p (dst, op0)
+			   low_register_operand (op1, SImode))
+			action = CONV;
+		  else if (rtx_equal_p (dst, op1)
+			low_register_operand (op0, SImode))
+			action = SWAP_CONV;
+		  break;
+		case ASHIFTRT:
+		case ASHIFT:
+		case LSHIFTRT:
+		  /* ASRS Rdn,Rm */
+		  if (rtx_equal_p (dst, op0)
+			   low_register_operand (op1, SImode))
+			action = CONV;
+		  /* ASRS Rd,Rm,#imm5 */
+		  else if (low_register_operand (op0, SImode)
+			CONST_INT_P (op1)
+			IN_RANGE 

Re: [PATCH][ARM] Improve 64-bit shifts (non-NEON)

2012-02-17 Thread Andrew Stubbs

On 16/02/12 15:33, Andrew Stubbs wrote:

OK for 4.8?


I forgot to address Ramana's comment about optimize_size.

This update fixes that and leaves everything else untouched.

OK?

Andrew
2012-02-17  Andrew Stubbs  a...@codesourcery.com

	gcc/
	* config/arm/arm-protos.h (arm_emit_coreregs_64bit_shift): New
	prototype.
	* config/arm/arm.c (arm_emit_coreregs_64bit_shift): New function.
	* config/arm/arm.md (ashldi3): Use arm_emit_coreregs_64bit_shift.
	(ashrdi3,lshrdi3): Likewise.
	(arm_cond_branch): Remove '*' to enable gen_arm_cond_branch.

---
 gcc/config/arm/arm-protos.h |3 +
 gcc/config/arm/arm.c|  201 +++
 gcc/config/arm/arm.md   |  104 --
 3 files changed, 280 insertions(+), 28 deletions(-)

diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 296550a..df8d7a9 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -242,6 +242,9 @@ struct tune_params
 
 extern const struct tune_params *current_tune;
 extern int vfp3_const_double_for_fract_bits (rtx);
+
+extern void arm_emit_coreregs_64bit_shift (enum rtx_code, rtx, rtx, rtx, rtx,
+	   rtx);
 #endif /* RTX_CODE */
 
 #endif /* ! GCC_ARM_PROTOS_H */
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index c3a19e4..02dc6ca 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -25213,5 +25213,206 @@ vfp3_const_double_for_fract_bits (rtx operand)
   return 0;
 }
 
+/* The default expansion of general 64-bit shifts in core-regs is suboptimal
+   on ARM, since we know that shifts by negative amounts are no-ops.
+
+   It's safe for the input and output to be the same register, but
+   early-clobber rules apply for the shift amount and scratch registers.
+
+   Shift by register requires both scratch registers.  Shift by a constant
+   less than 32 in Thumb2 mode requires SCRATCH1 only.  In all other cases
+   the scratch registers may be NULL.
+
+   Additionally, ashiftrt by a register also clobbers the CC register.  */
+void
+arm_emit_coreregs_64bit_shift (enum rtx_code code, rtx out, rtx in,
+			   rtx amount, rtx scratch1, rtx scratch2)
+{
+  rtx out_high = gen_highpart (SImode, out);
+  rtx out_low = gen_lowpart (SImode, out);
+  rtx in_high = gen_highpart (SImode, in);
+  rtx in_low = gen_lowpart (SImode, in);
+
+  /* Bits flow from up-stream to down-stream.  */
+  rtx out_up   = code == ASHIFT ? out_low : out_high;
+  rtx out_down = code == ASHIFT ? out_high : out_low;
+  rtx in_up   = code == ASHIFT ? in_low : in_high;
+  rtx in_down = code == ASHIFT ? in_high : in_low;
+
+  gcc_assert (code == ASHIFT || code == ASHIFTRT || code == LSHIFTRT);
+  gcc_assert (out
+	   (REG_P (out) || GET_CODE (out) == SUBREG)
+	   GET_MODE (out) == DImode);
+  gcc_assert (in
+	   (REG_P (in) || GET_CODE (in) == SUBREG)
+	   GET_MODE (in) == DImode);
+  gcc_assert (amount
+	   (((REG_P (amount) || GET_CODE (amount) == SUBREG)
+		GET_MODE (amount) == SImode)
+		  || CONST_INT_P (amount)));
+  gcc_assert (scratch1 == NULL
+	  || (GET_CODE (scratch1) == SCRATCH)
+	  || (GET_MODE (scratch1) == SImode
+		   REG_P (scratch1)));
+  gcc_assert (scratch2 == NULL
+	  || (GET_CODE (scratch2) == SCRATCH)
+	  || (GET_MODE (scratch2) == SImode
+		   REG_P (scratch2)));
+  gcc_assert (!REG_P (out) || !REG_P (amount)
+	  || !HARD_REGISTER_P (out)
+	  || (REGNO (out) != REGNO (amount)
+		   REGNO (out) + 1 != REGNO (amount)));
+
+  /* Macros to make following code more readable.  */
+  #define SUB_32(DEST,SRC) \
+	gen_addsi3 ((DEST), (SRC), gen_rtx_CONST_INT (VOIDmode, -32))
+  #define RSB_32(DEST,SRC) \
+	gen_subsi3 ((DEST), gen_rtx_CONST_INT (VOIDmode, 32), (SRC))
+  #define SUB_S_32(DEST,SRC) \
+	gen_addsi3_compare0 ((DEST), (SRC), \
+ gen_rtx_CONST_INT (VOIDmode, -32))
+  #define SET(DEST,SRC) \
+	gen_rtx_SET (SImode, (DEST), (SRC))
+  #define SHIFT(CODE,SRC,AMOUNT) \
+	gen_rtx_fmt_ee ((CODE), SImode, (SRC), (AMOUNT))
+  #define LSHIFT(CODE,SRC,AMOUNT) \
+	gen_rtx_fmt_ee ((CODE) == ASHIFT ? ASHIFT : LSHIFTRT, \
+			SImode, (SRC), (AMOUNT))
+  #define REV_LSHIFT(CODE,SRC,AMOUNT) \
+	gen_rtx_fmt_ee ((CODE) == ASHIFT ? LSHIFTRT : ASHIFT, \
+			SImode, (SRC), (AMOUNT))
+  #define ORR(A,B) \
+	gen_rtx_IOR (SImode, (A), (B))
+  #define BRANCH(COND,LABEL) \
+	gen_arm_cond_branch ((LABEL), \
+ gen_rtx_ ## COND (CCmode, cc_reg, \
+		   const0_rtx), \
+ cc_reg)
+
+  if (CONST_INT_P (amount))
+{
+  /* Shifts by a constant amount.  */
+  if (INTVAL (amount) = 0)
+	/* Match what shift-by-register would do.  */
+	emit_insn (gen_movdi (out, in));
+  else if (INTVAL (amount) = 64)
+	{
+	  /* Match what shift-by-register would do.  */
+	  if (code == ASHIFTRT)
+	{
+	  rtx const31_rtx = gen_rtx_CONST_INT (VOIDmode, 31);
+	  emit_insn (SET (out_down, SHIFT (code, in_up, const31_rtx)));
+	  emit_insn (SET (out_up, SHIFT 

Re: [RFC 4.8] use ip+cfa to identify unwind frames, if possible

2012-02-17 Thread David Daney

On 02/16/2012 03:32 PM, Richard Sandiford wrote:

David Daneydavid.da...@cavium.com  writes:

On 02/16/2012 02:12 PM, Richard Henderson wrote:
[...]


Thanks for the patch.


index 1c19f8b..59d4560 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2920,3 +2920,15 @@ extern GTY(()) struct target_globals *mips16_globals;
  with arguments ARGS.  */
   #define PMODE_INSN(NAME, ARGS) \
 (Pmode == SImode ? NAME ## _si ARGS : NAME ## _di ARGS)
+
+/* For mips32 mode we have bits 0 and 1 zero free, but for mips16 mode,
+   bit 0 indicates mips16 mode, and bit 1 is thence meaningful.  Thus
+   the only free bits would be at the top of the address space.
+   Can we trust that we'll never try to unwind in kernel mode?  */


That's too bad.  I guess if we ever want to unwind in kernel mode, we
can say no mips16 and switch it to a low-order bit for that application.
   Or write our own unwinder.


I suppose the problem is that baremetal often runs in kernel mode.
(Normal mips*-elf gdbsim testing works that way.)

But I think we'd be fine if we restrict the IP matching to non-MIPS16 mode.
GCC doesn't have any other special RA save registers, and now's a good time
to say that such a thing won't be allowed in MIPS16 or microMIPS code
(or in anything, probably).

So maybe we could set private_1 to (IP | 2) when (IP  3) == 0,
and leave it at 0 otherwise.  It's then a forced unwind unless
(IP  3) == 2.  Not as elegant as the single bit though.



Just off the top of my head (with out actually looking at the code).  Is 
there anything that could be done with the register zero save slot (if 
it even exists)?




Richard






Re: [RFC 4.8] use ip+cfa to identify unwind frames, if possible

2012-02-17 Thread Richard Henderson
On 02/17/12 09:31, David Daney wrote:
 Just off the top of my head (with out actually looking at the code).  Is 
 there anything that could be done with the register zero save slot (if it 
 even exists)?

No.  We're talking about saving information in the exception structure between 
unwindings.


r~


[Patch,AVR] Fix/hack around spill fail ICE PR52148

2012-02-17 Thread Georg-Johann Lay
Spill failure PR52148 occurs for movmem insn that allocates 2 of AVR's 3
pointer registers. Register allocator is at it's limits and the patch tries to
cure the situation by replacing

(match_operand:HI 0 register_operand x)

with explicit

(reg:HI REG_X)

and similar for Z Register classes x and z contain only one HI register.

This PR and PR50925 show that register allocator has some problems.
Even though this patch is not a fix of the root cause, it allows the PR's test
case to compile.

Anyways, the patch simplifies the backend and replaces an insn with 11(!)
operands with an insn with only 2 operands so that the patch is improvement of
the backend.

The hard registers are already known at expand time so there is no need for
match_operands.

Passes without regression.

Ok for trunk?

Johann

PR target/52148
* config/avr/avr.md (movmem_mode): Replace match_operand that
match only one single hard register with respective hard reg rtx.
(movmemx_mode): Ditto.
* config/avr/avr.c (avr_emit_movmemhi): Adapt expanding to new
insn anatomy of movmem[x]_mode.
(avr_out_movmem): Same for printing assembler and operand usage.

Index: config/avr/avr.md
===
--- config/avr/avr.md	(revision 184269)
+++ config/avr/avr.md	(working copy)
@@ -461,6 +461,9 @@ (define_insn xload_8
(set_attr isa lpmx,lpm)
(set_attr cc none)])
 
+;; R21:Z : 24-bit source address
+;; R22   : 1-4 byte output
+
 ;; xload_qi_libgcc
 ;; xload_hi_libgcc
 ;; xload_psi_libgcc
@@ -841,24 +844,23 @@ (define_expand movmemhi
 (define_mode_attr MOVMEM_r_d [(QI r)
   (HI wd)])
 
-;; $0, $4 :  dest (REG_X)
-;; $1, $5 :  src  (REG_Z)
-;; $2 : Address Space
-;; $3, $7 : Loop register
-;; $6 : Scratch register
+;; $0 : Address Space
+;; $1, $2 : Loop register
+;; R30: source address
+;; R26: destination address
 
 ;; movmem_qi
 ;; movmem_hi
 (define_insn movmem_mode
-  [(set (mem:BLK (match_operand:HI 0 register_operand x))
-(mem:BLK (match_operand:HI 1 register_operand z)))
-   (unspec [(match_operand:QI 2 const_int_operand n)]
+  [(set (mem:BLK (reg:HI REG_X))
+(mem:BLK (reg:HI REG_Z)))
+   (unspec [(match_operand:QI 0 const_int_operand n)]
UNSPEC_MOVMEM)
-   (use (match_operand:QIHI 3 register_operand   MOVMEM_r_d))
-   (clobber (match_operand:HI 4 register_operand =0))
-   (clobber (match_operand:HI 5 register_operand =1))
-   (clobber (match_operand:QI 6 register_operand =r))
-   (clobber (match_operand:QIHI 7 register_operand   =3))]
+   (use (match_operand:QIHI 1 register_operand MOVMEM_r_d))
+   (clobber (reg:HI REG_X))
+   (clobber (reg:HI REG_Z))
+   (clobber (reg:QI LPM_REGNO))
+   (clobber (match_operand:QIHI 2 register_operand =1))]
   
   {
 return avr_out_movmem (insn, operands, NULL);
@@ -866,26 +868,28 @@ (define_insn movmem_mode
   [(set_attr adjust_len movmem)
(set_attr cc clobber)])
 
-;; Ditto and
-;; $3, $7 : Loop register = R24
-;; $8, $9 : hh8 ( src)   = R23
-;; $10: RAMPZ_ADDR
+
+;; $0: Address Space
+;; $1: RAMPZ RAM address
+;; R24   : #bytes and loop register
+;; R23:Z : 24-bit source address
+;; R26   : 16-bit destination address
 
 ;; movmemx_qi
 ;; movmemx_hi
 (define_insn movmemx_mode
-  [(set (mem:BLK (match_operand:HI 0 register_operand x))
-(mem:BLK (lo_sum:PSI (match_operand:QI 8 register_operand r)
- (match_operand:HI 1 register_operand z
-   (unspec [(match_operand:QI 2 const_int_operand n)]
+  [(set (mem:BLK (reg:HI REG_X))
+(mem:BLK (lo_sum:PSI (reg:QI 23)
+ (reg:HI REG_Z
+   (unspec [(match_operand:QI 0 const_int_operand n)]
UNSPEC_MOVMEM)
-   (use (match_operand:QIHI 3 register_operand   w))
-   (clobber (match_operand:HI 4 register_operand =0))
-   (clobber (match_operand:HI 5 register_operand =1))
-   (clobber (match_operand:QI 6 register_operand =r))
-   (clobber (match_operand:HI 7 register_operand =3))
-   (clobber (match_operand:QI 9 register_operand =8))
-   (clobber (mem:QI (match_operand:QI 10 io_address_operand   n)))]
+   (use (reg:QIHI 24))
+   (clobber (reg:HI REG_X))
+   (clobber (reg:HI REG_Z))
+   (clobber (reg:QI LPM_REGNO))
+   (clobber (reg:HI 24))
+   (clobber (reg:QI 23))
+   (clobber (mem:QI (match_operand:QI 1 io_address_operand n)))]
   
   %~call __movmemx_mode
   [(set_attr type xcall)
Index: config/avr/avr.c
===
--- config/avr/avr.c	(revision 184269)
+++ config/avr/avr.c	(working copy)
@@ -9898,7 +9898,7 @@ avr_emit_movmemhi (rtx *xop)
   HOST_WIDE_INT count;
   enum machine_mode loop_mode;
   addr_space_t as = MEM_ADDR_SPACE (xop[1]);
-  rtx loop_reg, addr0, addr1, a_src, 

Re: [libitm] Link with -litm and -pthread

2012-02-17 Thread Andreas Krebbel
On 02/14/2012 11:58 PM, Eric Botcazou wrote:
 I see several new fails on s390x with that patch (r184174):
 
 People should realize that -fgnu-tm doesn't really work if libitm hasn't been 
 ported to the architecture, for example s390/s390x.  My understanding is that 
 Hans-Peter's patch should have taken care of this now.
 
Sure I'm very well aware that -fgnu-tm cannot work on s390 since we do not have 
libitm
support yet. So I think the option should simply *not* be used by the testsuite.

However, it still fails with r184339.

The dg-require check does not seem to work properly. Since it only affects the 
lto tm
testcases perhaps the lib/lto.exp magic dealing with the _0 and _1 files 
doesn't handle it
properly?!

Bye,

-Andreas-



Re: [wwwdocs] add information on TILE-Gx/TILEPro ports

2012-02-17 Thread Gerald Pfeifer
On Tue, 14 Feb 2012, Walter Lee wrote:
 This patch adds information on the Tile-Gx/TILEPro ports to wwwdocs.  
 Ok to commit? (assuming I have commit rights which I have not tried.)

Yes (and yes). :-)

If you'd like to mention your name in the news item, like we have
in other cases, that would be perfectly fine as well.

Thanks,
Gerald


Re: [wwwdocs] add information on TILE-Gx/TILEPro ports

2012-02-17 Thread Walter Lee

On 2/17/2012 1:30 PM, Gerald Pfeifer wrote:

On Tue, 14 Feb 2012, Walter Lee wrote:

This patch adds information on the Tile-Gx/TILEPro ports to wwwdocs.
Ok to commit? (assuming I have commit rights which I have not tried.)


Yes (and yes). :-)

If you'd like to mention your name in the news item, like we have
in other cases, that would be perfectly fine as well.


Great thanks.  I added my name and committed.

Walter


Go patch committed: Check for initialization loop in constant init

2012-02-17 Thread Ian Lance Taylor
In Go it is possible to have an initialization loop in a constant
initializer, if the initializer is a function pointer.  This patch adds
that check to the gccgo frontend.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r e19e56d17d8c go/gogo-tree.cc
--- a/go/gogo-tree.cc	Fri Feb 17 07:42:24 2012 -0800
+++ b/go/gogo-tree.cc	Fri Feb 17 11:02:24 2012 -0800
@@ -834,8 +834,15 @@
 	  else if (init == NULL_TREE)
 		;
 	  else if (TREE_CONSTANT(init))
-		this-backend()-global_variable_set_init(var,
-			  tree_to_expr(init));
+		{
+		  if (expression_requires(no-var_value()-init(), NULL, no))
+		error_at(no-location(),
+			 initialization expression for %qs depends 
+			 upon itself,
+			 no-message_name().c_str());
+		  this-backend()-global_variable_set_init(var,
+			tree_to_expr(init));
+		}
 	  else if (is_sink)
 		var_init_tree = init;
 	  else


Go patch committed: Fix interface method representation

2012-02-17 Thread Ian Lance Taylor
In Go an interface method always takes a receiver parameter.  The gccgo
frontend was not correctly representing that in the backend type
information generated for an interface value.  This didn't make any
difference for code generation, but it would mess up debug info and
perhaps other things as well.  This patch fixes the problem.
Bootstrapped and ran Go testusite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r ec4ce2b28cd0 go/types.cc
--- a/go/types.cc	Fri Feb 17 11:25:56 2012 -0800
+++ b/go/types.cc	Fri Feb 17 11:46:23 2012 -0800
@@ -6886,10 +6886,37 @@
p != type-methods()-end();
++p, ++i)
 {
+  // The type of the method in Go only includes the parameters.
+  // The actual method also has a receiver, which is always a
+  // pointer.  We need to add that pointer type here in order to
+  // generate the correct type for the backend.
+  Function_type* ft = p-type()-function_type();
+  go_assert(ft-receiver() == NULL);
+
+  const Typed_identifier_list* params = ft-parameters();
+  Typed_identifier_list* mparams = new Typed_identifier_list();
+  if (params != NULL)
+	mparams-reserve(params-size() + 1);
+  Type* vt = Type::make_pointer_type(Type::make_void_type());
+  mparams-push_back(Typed_identifier(, vt, ft-location()));
+  if (params != NULL)
+	{
+	  for (Typed_identifier_list::const_iterator pp = params-begin();
+	   pp != params-end();
+	   ++pp)
+	mparams-push_back(*pp);
+	}
+
+  Typed_identifier_list* mresults = (ft-results() == NULL
+	 ? NULL
+	 : ft-results()-copy());
+  Function_type* mft = Type::make_function_type(NULL, mparams, mresults,
+		ft-location());
+
   mfields[i].name = Gogo::unpack_hidden_name(p-name());
   mfields[i].btype = (use_placeholder
-			  ? p-type()-get_backend_placeholder(gogo)
-			  : p-type()-get_backend(gogo));
+			  ? mft-get_backend_placeholder(gogo)
+			  : mft-get_backend(gogo));
   mfields[i].location = loc;
   // Sanity check: the names should be sorted.
   go_assert(p-name()  last_name);


[v3] libstdc++/47058

2012-02-17 Thread Benjamin Kosnik

Adds support for disabling -Werror with --disable-werror configure flag.

tested x86/linux --enable-maintainer-mode
tested x86/linux --enable-maintainer-mode --disable-werror

-benjamin2012-02-17  Benjamin Kosnik  b...@redhat.com

	PR libstdc++/47058
	* acinclude.m4 (GLIBCXX_ENABLE_WERROR): New.
	(GLIBCXX_EXPORT_FLAGS): Add -Wabi to WARN_FLAGS
	* configure.ac: Use it.
	* fragment.am: Set WERROR_FLAG conditionally on --disable-werror.
	* configure: Regenerate.
	* python/Makefile.in: Same.
	* Makefile.in: Same.
	* doc/Makefile.in: Same.
	* include/Makefile.in: Same.
	* po/Makefile.in: Same.
	* python/Makefile.in: Same.
	* src/Makefile.in: Same.
	* src/c++11/Makefile.in: Same.
	* src/c++98/Makefile.in: Same.
	* testsuite/Makefile.in: Same.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index e7ffacc..46a5532 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -729,7 +729,7 @@ AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
   AC_SUBST(OPTIMIZE_CXXFLAGS)
 
-  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
+  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi'
   AC_SUBST(WARN_FLAGS)
 ])
 
@@ -3591,6 +3591,17 @@ AC_SUBST(python_mod_dir)
 GLIBCXX_CONDITIONAL(ENABLE_PYTHONDIR, test $python_mod_dir != no)
 ])
 
+dnl
+dnl Check to see if -Werror is disabled.
+dnl
+dnl --enable-werror/--disable-werror
+AC_DEFUN([GLIBCXX_ENABLE_WERROR], [
+  AC_MSG_CHECKING([for -Werror])
+  GLIBCXX_ENABLE(werror,$1,,[turns on -Werror])
+  AC_MSG_RESULT($enable_werror)
+  GLIBCXX_CONDITIONAL(ENABLE_WERROR, test $enable_werror = yes)
+])
+
 
 # Macros from the top-level gcc directory.
 m4_include([../config/gc++filt.m4])
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 81b523f..49de141 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -131,6 +131,7 @@ GLIBCXX_ENABLE_CXX_FLAGS
 GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
 GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes])
 GLIBCXX_ENABLE_PYTHON
+GLIBCXX_ENABLE_WERROR([yes])
 
 # Checks for operating systems support that doesn't require linking.
 GLIBCXX_CHECK_MATH_PROTO
diff --git a/libstdc++-v3/fragment.am b/libstdc++-v3/fragment.am
index 2bcbc1a..304d396 100644
--- a/libstdc++-v3/fragment.am
+++ b/libstdc++-v3/fragment.am
@@ -13,12 +13,18 @@ STAMP = echo timestamp 
 toolexecdir = $(glibcxx_toolexecdir)
 toolexeclibdir = $(glibcxx_toolexeclibdir)
 
+if ENABLE_WERROR
+WERROR_FLAG=$(WERROR)
+else
+WERROR_FLAG=
+endif
+
 # These bits are all figured out from configure.  Look in acinclude.m4
 # or configure.ac to see how they are set.  See GLIBCXX_EXPORT_FLAGS.
 CONFIG_CXXFLAGS = \
 	$(SECTION_FLAGS) $(EXTRA_CXX_FLAGS) -frandom-seed=$@
 WARN_CXXFLAGS = \
-	$(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once -Wabi
+	$(WARN_FLAGS) $(WERROR_FLAG) -fdiagnostics-show-location=once 
 
 # -I/-D flags to pass when compiling.
 AM_CPPFLAGS = $(GLIBCXX_INCLUDES)


Re: Continue strict-volatile-bitfields fixes

2012-02-17 Thread Thomas Schwinge
Hi!

How do we move this issue forward?

On Mon, 23 Jan 2012 15:46:34 +0100, Bernd Schmidt ber...@codesourcery.com 
wrote:
 On 11/29/2011 05:35 PM, Mitchell, Mark wrote:
  So, I still think this patch is the best way to go forward, and it
  does
  fix incorrect code generation. Would appreciate an OK.
 
  Ping.
  
  If you don't hear any objections within a week, please proceed.
 
 That was committed a while ago. The part in stor-layout.c that stops us
 from promoting bitfields to normal fields apparently caused some
 testsuite regressions in sh tests, where some optimization dump scans
 show that we can't perform the optimizations if there are BIT_FIELD_REFs
 rather than a normal member access.
 
 The testcases use things like
   enum something field:8;
 and I think applying strict-volatile-bitfields to enums is probably
 meaningless. Should we adjust semantics so that the compiler is free to
 optimize enum bitfields? The patch would look something like the below.
 Thomas has tested this on arm and sh with our internal tree.
 
 
 Bernd
 
 
 Index: gcc/stor-layout.c
 ===
 --- gcc/stor-layout.c (revision 355696)
 +++ gcc/stor-layout.c (working copy)
 @@ -665,8 +665,7 @@
may make a volatile object later.  */
 if (TYPE_SIZE (type) != 0
  TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
 -GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT
 -flag_strict_volatile_bitfields = 0)
 +GET_MODE_CLASS (TYPE_MODE (type)) == MODE_INT)
   {
 enum machine_mode xmode
   = mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);
 @@ -674,7 +673,12 @@
 
 if (xmode != BLKmode
  !(xalign  BITS_PER_UNIT  DECL_PACKED (decl))
 -(known_align == 0 || known_align = xalign))
 +(known_align == 0 || known_align = xalign)
 +   (flag_strict_volatile_bitfields = 0
 +  /* Same size makes strict volatile bitfields
 meaningless.  */
 +  || GET_MODE_SIZE (xmode) == GET_MODE_SIZE
 (TYPE_MODE (type))
 +  /* Strict volatile bitfields shouldn't apply to
 enums.  */
 +  || TREE_CODE (type) == ENUMERAL_TYPE))
   {
 DECL_ALIGN (decl) = MAX (xalign, DECL_ALIGN (decl));
 DECL_MODE (decl) = xmode;
 


Grüße,
 Thomas


pgpB3reRBrGcX.pgp
Description: PGP signature


Re: [v3] libstdc++/51798

2012-02-17 Thread Benjamin Kosnik

Noticed that the config for the new atomic builtins was not correct for
targets that did not do link tests. (ie x86-x-cris-elf). Fixed as
follows.

tested x86/linux
tested x86/linux x cris-elf

-benjamin2012-02-17  Benjamin Kosnik  b...@redhat.com

PR libstdc++/51798 continued.
* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Grep for
__atomic_, not __sync.


diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 46a5532..b832527 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2824,7 +2824,7 @@ EOF
 
 AC_MSG_CHECKING([for atomic builtins for bool])
 if AC_TRY_EVAL(ac_compile); then
-  if grep __sync_ conftest.s /dev/null 21 ; then
+  if grep __atomic_ conftest.s /dev/null 21 ; then
 	glibcxx_cv_atomic_bool=no
   else
 	glibcxx_cv_atomic_bool=yes
@@ -2853,7 +2853,7 @@ EOF
 
 AC_MSG_CHECKING([for atomic builtins for short])
 if AC_TRY_EVAL(ac_compile); then
-  if grep __sync_ conftest.s /dev/null 21 ; then
+  if grep __atomic_ conftest.s /dev/null 21 ; then
 	glibcxx_cv_atomic_short=no
   else
 	glibcxx_cv_atomic_short=yes
@@ -2883,7 +2883,7 @@ EOF
 
 AC_MSG_CHECKING([for atomic builtins for int])
 if AC_TRY_EVAL(ac_compile); then
-  if grep __sync_ conftest.s /dev/null 21 ; then
+  if grep __atomic_ conftest.s /dev/null 21 ; then
 	glibcxx_cv_atomic_int=no
   else
 	glibcxx_cv_atomic_int=yes
@@ -2912,7 +2912,7 @@ EOF
 
 AC_MSG_CHECKING([for atomic builtins for long long])
 if AC_TRY_EVAL(ac_compile); then
-  if grep __sync_ conftest.s /dev/null 21 ; then
+  if grep __atomic_ conftest.s /dev/null 21 ; then
 	glibcxx_cv_atomic_long_long=no
   else
 	glibcxx_cv_atomic_long_long=yes


Re: [patch, testsuite] PR 52229, testsuite failure

2012-02-17 Thread Thomas Koenig

Am 13.02.2012 21:39, schrieb Thomas Koenig:

Ping?


Hello world,

the attached patch xfails the offencing test case on architectures
which do not allow unaligned access for vecorization. OK for trunk?
Any other architectures which should be XFAILed?

Regression-tested on powerpc64-unknown-linux-gnu. OK for trunk?

Thomas

2012-02-13 Thomas Koenig tkoe...@gcc.gnu.org

PR testsuite/52229
PR fortran/32380
* gfortran.dg/vect/pr32380.f: XFAIL on PowerPC and ia-64.




Go patch committed: Add -o option when linking

2012-02-17 Thread Ian Lance Taylor
The Go compiler needs to see all input files at once, rather than be
invoked separately on each one.  The gcc driver will only do that if the
static combine_inputs variable is set.  And combine_inputs is only set
if the -o option is used (or LTO-specific -fwpa option is used).  The
gccgo driver currently automatically adds a -o option when compiling
when no -o option is seen.  That is sufficient for the normal case, but
does not handle the case of linking without a -o option.  Linking
without a -o option is unusual but of course it ought to work correctly.
I don't want to mess with the general driver code in stage 4, so I have
modified the gccgo driver to add a -o option even when linking.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian


2012-02-17  Ian Lance Taylor  i...@google.com

* gospec.c (lang_specific_driver): If linking, and no -o option
was used, add one.


Index: gcc/go/gospec.c
===
--- gcc/go/gospec.c	(revision 184188)
+++ gcc/go/gospec.c	(working copy)
@@ -109,6 +109,11 @@ lang_specific_driver (struct cl_decoded_
   /* Whether the -o option was used.  */
   bool saw_opt_o = false;
 
+  /* Whether the -c option was used.  Also used for -E, -fsyntax-only,
+ in general anything which implies only compilation and not
+ linking.  */
+  bool saw_opt_c = false;
+
   /* Whether the -S option was used.  */
   bool saw_opt_S = false;
 
@@ -172,6 +177,7 @@ lang_specific_driver (struct cl_decoded_
 	case OPT_fsyntax_only:
 	  /* Don't specify libraries if we won't link, since that would
 	 cause a warning.  */
+	  saw_opt_c = true;
 	  library = -1;
 	  break;
 
@@ -272,31 +278,39 @@ lang_specific_driver (struct cl_decoded_
   j++;
 }
 
-  /* If we are not linking, add a -o option.  This is because we need
+  /* If we didn't see a -o option, add one.  This is because we need
  the driver to pass all .go files to go1.  Without a -o option the
- driver will invoke go1 separately for each input file.  */
-  if (library  0  first_go_file != NULL  !saw_opt_o)
+ driver will invoke go1 separately for each input file.  FIXME:
+ This should probably use some other interface to force the driver
+ to set combine_inputs.  */
+  if (first_go_file != NULL  !saw_opt_o)
 {
-  const char *base;
-  int baselen;
-  int alen;
-  char *out;
-
-  base = lbasename (first_go_file);
-  baselen = strlen (base) - 3;
-  alen = baselen + 3;
-  out = XNEWVEC (char, alen);
-  memcpy (out, base, baselen);
-  /* The driver will convert .o to some other suffix (e.g., .obj)
-	 if appropriate.  */
-  out[baselen] = '.';
-  if (saw_opt_S)
-	out[baselen + 1] = 's';
+  if (saw_opt_c || saw_opt_S)
+	{
+	  const char *base;
+	  int baselen;
+	  int alen;
+	  char *out;
+
+	  base = lbasename (first_go_file);
+	  baselen = strlen (base) - 3;
+	  alen = baselen + 3;
+	  out = XNEWVEC (char, alen);
+	  memcpy (out, base, baselen);
+	  /* The driver will convert .o to some other suffix (e.g.,
+	 .obj) if appropriate.  */
+	  out[baselen] = '.';
+	  if (saw_opt_S)
+	out[baselen + 1] = 's';
+	  else
+	out[baselen + 1] = 'o';
+	  out[baselen + 2] = '\0';
+	  generate_option (OPT_o, out, 1, CL_DRIVER,
+			   new_decoded_options[j]);
+	}
   else
-	out[baselen + 1] = 'o';
-  out[baselen + 2] = '\0';
-  generate_option (OPT_o, out, 1, CL_DRIVER,
-		   new_decoded_options[j]);
+	generate_option (OPT_o, a.out, 1, CL_DRIVER,
+			 new_decoded_options[j]);
   j++;
 }
 


Go patch committed: Don't lower binary exprs with mismatched types

2012-02-17 Thread Ian Lance Taylor
The Go frontend was accidentally lowering binary expressions with
mismatched types.  It would reject two integer constant expressions with
mismatched types, but would then go on to try to see if the expressions
had floating point constant values.  Since all integer constants can be
viewed as floating point constants in Go, this would let the binary
expressions be lowered as a floating point expressions, despite the
mismatched types.  This patch fixes the problem.  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 5c9dac6bacc3 go/expressions.cc
--- a/go/expressions.cc	Fri Feb 17 11:58:53 2012 -0800
+++ b/go/expressions.cc	Fri Feb 17 13:38:46 2012 -0800
@@ -5564,6 +5564,7 @@
 	 op != OPERATOR_RSHIFT)
 	  {
 	// May be a type error--let it be diagnosed later.
+	return this;
 	  }
 	else if (is_comparison)
 	  {
@@ -5667,6 +5668,7 @@
 	 op != OPERATOR_RSHIFT)
 	  {
 	// May be a type error--let it be diagnosed later.
+	return this;
 	  }
 	else if (is_comparison)
 	  {
@@ -5750,6 +5752,7 @@
 	 left_type-base() != right_type-base())
 	  {
 	// May be a type error--let it be diagnosed later.
+	return this;
 	  }
 	else if (op == OPERATOR_EQEQ || op == OPERATOR_NOTEQ)
 	  {


Go patch committed: Add parameter names to export information

2012-02-17 Thread Ian Lance Taylor
I got a request to add function parameter names to the Go export
information, so that tools that do context-sensitive help, such as some
IDEs, have more information to present to the user.  This patch
implements that request.  This is an incompatible change to the export
format--all existing packages will have to be rebuilt.  That is not so
bad since 4.7 is incompatible with 4.6 anyhow.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2012-02-17  Ian Lance Taylor  i...@google.com

* Make-lang.in (go/import.o): Add dependency on $(GO_LEX_H).


Index: gcc/go/Make-lang.in
===
--- gcc/go/Make-lang.in	(revision 184221)
+++ gcc/go/Make-lang.in	(working copy)
@@ -295,7 +295,8 @@ go/gogo.o: go/gofrontend/gogo.cc $(GO_SY
 	$(GO_IMPORT_H) $(GO_EXPORT_H) go/gofrontend/backend.h $(GO_GOGO_H)
 go/import.o: go/gofrontend/import.cc $(GO_SYSTEM_H) \
 	$(srcdir)/../include/filenames.h $(srcdir)/../include/simple-object.h \
-	$(GO_C_H) $(GO_GOGO_H) $(GO_TYPES_H) $(GO_EXPORT_H) $(GO_IMPORT_H)
+	$(GO_C_H) $(GO_GOGO_H) $(GO_LEX_H) $(GO_TYPES_H) $(GO_EXPORT_H) \
+	$(GO_IMPORT_H)
 go/import-archive.o: go/gofrontend/import-archive.cc $(GO_SYSTEM_H) \
 	$(GO_IMPORT_H)
 go/lex.o: go/gofrontend/lex.cc $(GO_LEX_H) $(GO_SYSTEM_H)
Index: gcc/go/gofrontend/gogo.cc
===
--- gcc/go/gofrontend/gogo.cc	(revision 184299)
+++ gcc/go/gofrontend/gogo.cc	(working copy)
@@ -3274,7 +3274,10 @@ Function::export_func_with_type(Export* 
   if (fntype-is_method())
 {
   exp-write_c_string(();
-  exp-write_type(fntype-receiver()-type());
+  const Typed_identifier* receiver = fntype-receiver();
+  exp-write_name(receiver-name());
+  exp-write_c_string( );
+  exp-write_type(receiver-type());
   exp-write_c_string() );
 }
 
@@ -3294,6 +3297,8 @@ Function::export_func_with_type(Export* 
 	first = false;
 	  else
 	exp-write_c_string(, );
+	  exp-write_name(p-name());
+	  exp-write_c_string( );
 	  if (!is_varargs || p + 1 != parameters-end())
 	exp-write_type(p-type());
 	  else
@@ -3308,7 +3313,7 @@ Function::export_func_with_type(Export* 
   const Typed_identifier_list* results = fntype-results();
   if (results != NULL)
 {
-  if (results-size() == 1)
+  if (results-size() == 1  results-begin()-name().empty())
 	{
 	  exp-write_c_string( );
 	  exp-write_type(results-begin()-type());
@@ -3325,6 +3330,8 @@ Function::export_func_with_type(Export* 
 		first = false;
 	  else
 		exp-write_c_string(, );
+	  exp-write_name(p-name());
+	  exp-write_c_string( );
 	  exp-write_type(p-type());
 	}
 	  exp-write_c_string());
@@ -3348,9 +3355,10 @@ Function::import_func(Import* imp, std::
   if (imp-peek_char() == '(')
 {
   imp-require_c_string(();
+  std::string name = imp-read_name();
+  imp-require_c_string( );
   Type* rtype = imp-read_type();
-  *preceiver = new Typed_identifier(Import::import_marker, rtype,
-	imp-location());
+  *preceiver = new Typed_identifier(name, rtype, imp-location());
   imp-require_c_string() );
 }
 
@@ -3366,6 +3374,9 @@ Function::import_func(Import* imp, std::
   parameters = new Typed_identifier_list();
   while (true)
 	{
+	  std::string name = imp-read_name();
+	  imp-require_c_string( );
+
 	  if (imp-match_c_string(...))
 	{
 	  imp-advance(3);
@@ -3375,8 +3386,8 @@ Function::import_func(Import* imp, std::
 	  Type* ptype = imp-read_type();
 	  if (*is_varargs)
 	ptype = Type::make_array_type(ptype, NULL);
-	  parameters-push_back(Typed_identifier(Import::import_marker,
-		 ptype, imp-location()));
+	  parameters-push_back(Typed_identifier(name, ptype,
+		 imp-location()));
 	  if (imp-peek_char() != ',')
 	break;
 	  go_assert(!*is_varargs);
@@ -3396,17 +3407,18 @@ Function::import_func(Import* imp, std::
   if (imp-peek_char() != '(')
 	{
 	  Type* rtype = imp-read_type();
-	  results-push_back(Typed_identifier(Import::import_marker, rtype,
-	  imp-location()));
+	  results-push_back(Typed_identifier(, rtype, imp-location()));
 	}
   else
 	{
 	  imp-require_c_string(();
 	  while (true)
 	{
+	  std::string name = imp-read_name();
+	  imp-require_c_string( );
 	  Type* rtype = imp-read_type();
-	  results-push_back(Typed_identifier(Import::import_marker,
-		  rtype, imp-location()));
+	  results-push_back(Typed_identifier(name, rtype,
+		  imp-location()));
 	  if (imp-peek_char() != ',')
 		break;
 	  imp-require_c_string(, );
Index: gcc/go/gofrontend/import.h
===
--- gcc/go/gofrontend/import.h	(revision 184188)
+++ gcc/go/gofrontend/import.h	(working copy)
@@ -181,14 +181,15 @@ class Import
   std::string
   read_identifier();
 
+  // Read a name.  This is like read_identifier, 

Re: [google/main] Check for cross-compilers in validate_failures.py (issue5674087)

2012-02-17 Thread 關振德
Should I submit toe trunk also, now that it is closed?

On Fri, Feb 17, 2012 at 4:52 AM, Diego Novillo dnovi...@google.com wrote:
 On 17/02/12 05:49 , Doug Kwan wrote:

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

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


 OK.  Thanks.


 Diego.


Go patch committed: List imported packages in export information

2012-02-17 Thread Ian Lance Taylor
This patch to the Go frontend changes it to list all imported packages
in the export information.  This is useful for tools which want to trace
package dependencies.  This is another incompatible change to the export
information--might as well do them together.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r f523a8f55403 go/export.cc
--- a/go/export.cc	Fri Feb 17 14:33:15 2012 -0800
+++ b/go/export.cc	Fri Feb 17 15:10:46 2012 -0800
@@ -93,6 +93,7 @@
 Export::export_globals(const std::string package_name,
 		   const std::string unique_prefix,
 		   int package_priority,
+		   const std::mapstd::string, Package* imports,
 		   const std::string import_init_fn,
 		   const std::setImport_init imported_init_fns,
 		   const Bindings* bindings)
@@ -149,6 +150,8 @@
   snprintf(buf, sizeof buf, priority %d;\n, package_priority);
   this-write_c_string(buf);
 
+  this-write_imports(imports);
+
   this-write_imported_init_fns(package_name, package_priority, import_init_fn,
 imported_init_fns);
 
@@ -177,7 +180,46 @@
   this-stream_-write_checksum(s);
 }
 
-// Write out the import control variables for this package.
+// Sort imported packages.
+
+static bool
+import_compare(const std::pairstd::string, Package* a,
+	   const std::pairstd::string, Package* b)
+{
+  return a.first  b.first;
+}
+
+// Write out the imported packages.
+
+void
+Export::write_imports(const std::mapstd::string, Package* imports)
+{
+  // Sort the imports for more consistent output.
+  std::vectorstd::pairstd::string, Package*  imp;
+  for (std::mapstd::string, Package*::const_iterator p = imports.begin();
+   p != imports.end();
+   ++p)
+imp.push_back(std::make_pair(p-first, p-second));
+
+  std::sort(imp.begin(), imp.end(), import_compare);
+
+  for (std::vectorstd::pairstd::string, Package* ::const_iterator p =
+	 imp.begin();
+   p != imp.end();
+   ++p)
+{
+  this-write_c_string(import );
+  this-write_string(p-second-name());
+  this-write_c_string( );
+  this-write_string(p-second-unique_prefix());
+  this-write_c_string( \);
+  this-write_string(p-first);
+  this-write_c_string(\;\n);
+}
+}
+
+// Write out the initialization functions which need to run for this
+// package.
 
 void
 Export::write_imported_init_fns(
@@ -189,7 +231,7 @@
   if (import_init_fn.empty()  imported_init_fns.empty())
 return;
 
-  this-write_c_string(import);
+  this-write_c_string(init);
 
   if (!import_init_fn.empty())
 {
diff -r f523a8f55403 go/export.h
--- a/go/export.h	Fri Feb 17 14:33:15 2012 -0800
+++ b/go/export.h	Fri Feb 17 15:10:46 2012 -0800
@@ -14,6 +14,7 @@
 class Import_init;
 class Bindings;
 class Type;
+class Package;
 
 // Codes used for the builtin types.  These are all negative to make
 // them easily distinct from the codes assigned by Export::write_type.
@@ -126,6 +127,7 @@
   export_globals(const std::string package_name,
 		 const std::string unique_prefix,
 		 int package_priority,
+		 const std::mapstd::string, Package* imports,
 		 const std::string import_init_fn,
 		 const std::setImport_init imported_init_fns,
 		 const Bindings* bindings);
@@ -158,6 +160,10 @@
   Export(const Export);
   Export operator=(const Export);
 
+  // Write out the imported packages.
+  void
+  write_imports(const std::mapstd::string, Package* imports);
+
   // Write out the imported initialization functions.
   void
   write_imported_init_fns(const std::string package_name, int priority,
diff -r f523a8f55403 go/gogo.cc
--- a/go/gogo.cc	Fri Feb 17 14:33:15 2012 -0800
+++ b/go/gogo.cc	Fri Feb 17 15:10:46 2012 -0800
@@ -2859,6 +2859,7 @@
   exp.export_globals(this-package_name(),
 		 this-unique_prefix(),
 		 this-package_priority(),
+		 this-imports_,
 		 (this-need_init_fn_  !this-is_main_package()
 		  ? this-get_init_fn_name()
 		  : ),
diff -r f523a8f55403 go/import.cc
--- a/go/import.cc	Fri Feb 17 14:33:15 2012 -0800
+++ b/go/import.cc	Fri Feb 17 15:10:46 2012 -0800
@@ -304,7 +304,10 @@
   this-package_-set_priority(prio);
   this-require_c_string(;\n);
 
-  if (stream-match_c_string(import ))
+  while (stream-match_c_string(import))
+	this-read_one_import();
+
+  if (stream-match_c_string(init))
 	this-read_import_init_fns(gogo);
 
   // Loop over all the input data for this package.
@@ -344,12 +347,24 @@
   return this-package_;
 }
 
+// Read an import line.  We don't actually care about these.
+
+void
+Import::read_one_import()
+{
+  this-require_c_string(import );
+  Stream* stream = this-stream_;
+  while (stream-peek_char() != ';')
+stream-advance(1);
+  this-require_c_string(;\n);
+}
+
 // Read the list of import control functions.
 
 void
 Import::read_import_init_fns(Gogo* gogo)
 {
-  this-require_c_string(import);
+  this-require_c_string(init);
   while (!this-match_c_string(;))
 {
   this-require_c_string( );
diff -r 

Re: [google/main] Check for cross-compilers in validate_failures.py (issue5674087)

2012-02-17 Thread Diego Novillo
On Fri, Feb 17, 2012 at 18:17, Doug Kwan (關振德) dougk...@google.com wrote:
 Should I submit toe trunk also, now that it is closed?

Yes, that's fine.  contrib/ is not release-critical.


Diego.


Re: [Patch, libfortran] RFC: Shared vtables, constification

2012-02-17 Thread Steven Bosscher
On Fri, Feb 17, 2012 at 12:44 PM, Janne Blomqvist
blomqvist.ja...@gmail.com wrote:
 On Mon, Feb 13, 2012 at 23:04, Steven Bosscher stevenb@gmail.com wrote:
 On Mon, Feb 13, 2012 at 7:20 PM, Janne Blomqvist
 blomqvist.ja...@gmail.com wrote:
 Hi,

 the attached patch changes the low-level libgfortran IO dispatching
 mechanism to use shared vtables for each stream type, instead of all
 the function pointers being replicated for each unit. This is similar
 to e.g. how the C++ frontend implements vtables. The benefits are:

 - Slightly smaller heap memory overhead for each unit as only the
 vtable pointer needs to be stored, and slightly faster unit
 initialization as only the vtable pointer needs to be setup instead of
 all the function pointers in the stream struct.

 - Looking at unix.o with readelf, one sees

 Relocation section '.rela.data.rel.ro.local.mem_vtable' at offset
 0x15550 contains 8 entries:

 and similarly for the other vtables; according to
 http://www.airs.com/blog/archives/189 this means that after relocation
 the page where this data resides may be marked read-only.

 The downside is that the sizes of the .text and .data sections are
 increased. Before:

   text    data     bss     dec     hex filename
 1116991    6664     592 1124247  112797
 ./x86_64-unknown-linux-gnu/libgfortran/.libs/libgfortran.so

 After:

   text    data     bss     dec     hex filename
 1117487    6936     592 1125015  112a97
 ./x86_64-unknown-linux-gnu/libgfortran/.libs/libgfortran.so


 The data section increase is due to the vtables, the text increase is,
 I guess, due to the extra pointer dereference when calling the IO
 functions.

 Regtested on x86_64-unknown-linux-gnu, Ok for trunk, or 4.8?

 Certainly not for trunk at this stage.

 Fair enough.

 For 4.8: So the trade-off is between faster initialization and smaller
 heap vs. fewer pointer dereferences?

 From a performance perspective, yes. Also, a multi-threaded program
 may benefit slightly from fewer cacheline ping-pongs due to the
 read-only vtables being separated from the RW data in the stream
 struct. That being said, while there are a few performance issues
 lurking here and there in libgfortran, virtual function dispatch isn't
 one of them. I think you'd be hard pressed to come up with a benchmark
 where you could see a difference.

The cache line thing had crossed my mind, too. I'm not sure if that's
a performance blocker for I/O in the end, though.


 The other advantage is that by putting the vtables in read-only pages,
 the chance of a buggy program getting a SIGSEGV instead of corrupting
 the library state is slightly increased.

Fair enough, that's a good reason to make this change.


 Does this patch fix an actual
 problem? Does it bring a killer feature?

 No, it's certainly not a killer feature. In general, considering the
 maturity of gfortran, I think it's unreasonable to expect that a
 bordering-on-trivial patch would bring a killer feature.

 The patch came about as a small experiment I did, and as I considered
 the result an overall improvement (even if admittedly quite a minor
 one), I added a ChangeLog and submitted it.

Heh, I did not mean to be unreasonable. I really appreciate all the
work you're doing on gfortran! :-)

Ciao!
Steven


Go patch committed: Permit (_) on left hand side of =

2012-02-17 Thread Ian Lance Taylor
In an oversight, the gccgo frontend rejected valid Go code
(_) = 1
This patch fixes the problem.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r bcfd45b0bd55 go/parse.cc
--- a/go/parse.cc	Fri Feb 17 15:19:05 2012 -0800
+++ b/go/parse.cc	Fri Feb 17 15:35:16 2012 -0800
@@ -2491,7 +2491,7 @@
   if (token-is_op(OPERATOR_LPAREN))
 	{
 	  this-advance_token();
-	  ret = this-expression(PRECEDENCE_NORMAL, false, true, NULL);
+	  ret = this-expression(PRECEDENCE_NORMAL, may_be_sink, true, NULL);
 	  if (!this-peek_token()-is_op(OPERATOR_RPAREN))
 	error_at(this-location(), missing %)%);
 	  else


Go patch committed: Permit empty interface to be embedded twice

2012-02-17 Thread Ian Lance Taylor
Interface embedding just means copying the interface methods, so there
is nothing wrong with embedding the empty interface more than once.
This patch fixes the gccgo frontend to permit that.  Bootstrapped and
ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 34a3fad98e88 go/types.cc
--- a/go/types.cc	Fri Feb 17 15:35:50 2012 -0800
+++ b/go/types.cc	Fri Feb 17 16:41:16 2012 -0800
@@ -6471,7 +6471,7 @@
 	}
 
   Named_type* nt = t-named_type();
-  if (nt != NULL)
+  if (nt != NULL  it-parse_methods_ != NULL)
 	{
 	  std::vectorNamed_type*::const_iterator q;
 	  for (q = seen.begin(); q != seen.end(); ++q)


[patch, committed] invoke.texi: big-endian, little-endian

2012-02-17 Thread Sandra Loosemore
I've checked in this patch to consistently hyphenate big-endian and 
little-endian when used as adjectives.  I observe that Jonathan Swift 
also hyphenated Big-endians when used as a noun in Gulliver's Travels, 
but I did not see any uses of either term as a noun in invoke.texi, so 
thankfully I did not have to deal with that case.  ;-)


-Sandra


2012-02-17  Sandra Loosemore  san...@codesourcery.com

gcc/
* doc/invoke.texi: Consistently hyphenate big-endian/little-endian
when used as adjectives.

Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi	(revision 184362)
+++ gcc/doc/invoke.texi	(working copy)
@@ -11486,11 +11486,11 @@ assembly code.  Permissible names are: @
 
 @item -mbig-endian
 @opindex mbig-endian
-Generate code for a big endian target.
+Generate code for a big-endian target.
 
 @item -mlittle-endian
 @opindex mlittle-endian
-Generate code for a little endian target.  This is the default.
+Generate code for a little-endian target.  This is the default.
 
 @item -msim
 @opindex msim
@@ -13829,11 +13829,11 @@ These are the @samp{-m} options defined 
 @table @gcctabopt
 @item -mbig-endian
 @opindex mbig-endian
-Generate code for a big endian target.  This is the default for HP-UX@.
+Generate code for a big-endian target.  This is the default for HP-UX@.
 
 @item -mlittle-endian
 @opindex mlittle-endian
-Generate code for a little endian target.  This is the default for AIX5
+Generate code for a little-endian target.  This is the default for AIX5
 and GNU/Linux.
 
 @item -mgnu-as
@@ -14745,7 +14745,7 @@ Prefer word access when reading byte qua
 @itemx -mbig-endian
 @opindex mlittle-endian
 @opindex mbig-endian
-Generate code for a little endian target.
+Generate code for a little-endian target.
 
 @item -m210
 @itemx -m340
@@ -16671,10 +16671,10 @@ Perform optimizations for the floating-p
 Generate code that uses (does not use) the load multiple word
 instructions and the store multiple word instructions.  These
 instructions are generated by default on POWER systems, and not
-generated on PowerPC systems.  Do not use @option{-mmultiple} on little
-endian PowerPC systems, since those instructions do not work when the
-processor is in little endian mode.  The exceptions are PPC740 and
-PPC750 which permit the instructions usage in little endian mode.
+generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
+PowerPC systems, since those instructions do not work when the
+processor is in little-endian mode.  The exceptions are PPC740 and
+PPC750 which permit these instructions in little-endian mode.
 
 @item -mstring
 @itemx -mno-string
@@ -16684,10 +16684,10 @@ Generate code that uses (does not use) t
 and the store string word instructions to save multiple registers and
 do small block moves.  These instructions are generated by default on
 POWER systems, and not generated on PowerPC systems.  Do not use
-@option{-mstring} on little endian PowerPC systems, since those
-instructions do not work when the processor is in little endian mode.
-The exceptions are PPC740 and PPC750 which permit the instructions
-usage in little endian mode.
+@option{-mstring} on little-endian PowerPC systems, since those
+instructions do not work when the processor is in little-endian mode.
+The exceptions are PPC740 and PPC750 which permit these instructions
+in little-endian mode.
 
 @item -mupdate
 @itemx -mno-update
@@ -16797,7 +16797,7 @@ used in the program.
 @opindex mlittle
 @opindex mlittle-endian
 On System V.4 and embedded PowerPC systems compile code for the
-processor in little endian mode.  The @option{-mlittle-endian} option is
+processor in little-endian mode.  The @option{-mlittle-endian} option is
 the same as @option{-mlittle}.
 
 @item -mbig
@@ -16805,7 +16805,7 @@ the same as @option{-mlittle}.
 @opindex mbig
 @opindex mbig-endian
 On System V.4 and embedded PowerPC systems compile code for the
-processor in big endian mode.  The @option{-mbig-endian} option is
+processor in big-endian mode.  The @option{-mbig-endian} option is
 the same as @option{-mbig}.
 
 @item -mdynamic-no-pic
@@ -17270,7 +17270,7 @@ selected.
 @opindex mbig-endian-data
 @opindex mlittle-endian-data
 Store data (but not code) in the big-endian format.  The default is
-@option{-mlittle-endian-data}, i.e.@: to store data in the little endian
+@option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
 format.
 
 @item -msmall-data-limit=@var{N}
@@ -17600,11 +17600,11 @@ These options are defined for Score impl
 @table @gcctabopt
 @item -meb
 @opindex meb
-Compile code for big endian mode.  This is the default.
+Compile code for big-endian mode.  This is the default.
 
 @item -mel
 @opindex mel
-Compile code for little endian mode.
+Compile code for little-endian mode.
 
 @item -mnhwloop
 @opindex mnhwloop
@@ -17725,11 +17725,11 @@ instructions at the moment.
 
 @item -mb
 @opindex mb
-Compile code for 

[google/gcc-4_6_2-mobile] PATCH: PR other/46770: Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them

2012-02-17 Thread H.J. Lu
Hi,

This patch backports the fix from trunk:

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

for google/gcc-4_6_2-mobile branch.  This is needed to support C++
global constructors/destructiors on Android/x86.  OK for
google/gcc-4_6_2-mobile branch?

Thanks.

H.J.
---
2011-08-20  H.J. Lu  hongjiu...@intel.com

PR other/46770
* config.gcc (tm_file): Add initfini-array.h if
.init_arrary/.fini_array are supported.

* crtstuff.c: Don't generate .ctors nor .dtors sections if
USE_INITFINI_ARRAY is defined.

* output.h (default_elf_init_array_asm_out_constructor): New.
(default_elf_fini_array_asm_out_destructor): Likewise.
* varasm.c (elf_init_array_section): Likewise.
(elf_fini_array_section): Likewise.
(get_elf_initfini_array_priority_section): Likewise.
(default_elf_init_array_asm_out_constructor): Likewise.
(default_elf_fini_array_asm_out_destructor): Likewise.

* config/initfini-array.h: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177933 
138bc75d-0d04-0410-961f-82ee72b054a4

Conflicts:

gcc/ChangeLog
---
 gcc/ChangeLog.hjl   |   21 +++
 gcc/config.gcc  |5 +++
 gcc/config/initfini-array.h |   37 +++
 gcc/crtstuff.c  |   11 +++-
 gcc/output.h|2 +
 gcc/varasm.c|   58 +++
 6 files changed, 133 insertions(+), 1 deletions(-)
 create mode 100644 gcc/ChangeLog.hjl
 create mode 100644 gcc/config/initfini-array.h

diff --git a/gcc/ChangeLog.hjl b/gcc/ChangeLog.hjl
new file mode 100644
index 000..3527b27
--- /dev/null
+++ b/gcc/ChangeLog.hjl
@@ -0,0 +1,21 @@
+2011-12-07  H.J. Lu  hongjiu...@intel.com
+
+   Backport from mainline
+   2011-08-20  H.J. Lu  hongjiu...@intel.com
+
+   PR other/46770
+   * config.gcc (tm_file): Add initfini-array.h if
+   .init_arrary/.fini_array are supported.
+
+   * crtstuff.c: Don't generate .ctors nor .dtors sections if
+   USE_INITFINI_ARRAY is defined.
+
+   * output.h (default_elf_init_array_asm_out_constructor): New.
+   (default_elf_fini_array_asm_out_destructor): Likewise.
+   * varasm.c (elf_init_array_section): Likewise.
+   (elf_fini_array_section): Likewise.
+   (get_elf_initfini_array_priority_section): Likewise.
+   (default_elf_init_array_asm_out_constructor): Likewise.
+   (default_elf_fini_array_asm_out_destructor): Likewise.
+
+   * config/initfini-array.h: New.
diff --git a/gcc/config.gcc b/gcc/config.gcc
index d9ac0fa..b386424 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3176,6 +3176,11 @@ if test x$with_schedule = x; then
esac
 fi
 
+# Support --enable-initfini-array.
+if test x$enable_initfini_array = xyes; then
+  tm_file=${tm_file} initfini-array.h
+fi
+
 # Validate and mark as valid any --with options supported
 # by this target.  In order to use a particular --with option
 # you must list it in supported_defaults; validating the value
diff --git a/gcc/config/initfini-array.h b/gcc/config/initfini-array.h
new file mode 100644
index 000..8aaadf6
--- /dev/null
+++ b/gcc/config/initfini-array.h
@@ -0,0 +1,37 @@
+/* Definitions for ELF systems with .init_array/.fini_array section
+   support.
+   Copyright (C) 2011
+   Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3, or (at your
+   option) any later version.
+
+   GCC is distributed in the hope that it will be useful, but 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 GCC; see the file COPYING3.  If not see
+   http://www.gnu.org/licenses/.  */
+
+#define USE_INITFINI_ARRAY
+
+#undef INIT_SECTION_ASM_OP
+#undef FINI_SECTION_ASM_OP
+
+#undef INIT_ARRAY_SECTION_ASM_OP
+#define INIT_ARRAY_SECTION_ASM_OP
+
+#undef FINI_ARRAY_SECTION_ASM_OP
+#define FINI_ARRAY_SECTION_ASM_OP
+
+/* Use .init_array/.fini_array section for constructors and destructors. */
+#undef TARGET_ASM_CONSTRUCTOR
+#define TARGET_ASM_CONSTRUCTOR default_elf_init_array_asm_out_constructor
+#undef TARGET_ASM_DESTRUCTOR
+#define TARGET_ASM_DESTRUCTOR default_elf_fini_array_asm_out_destructor
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c
index b65f490..010d472 100644
--- a/gcc/crtstuff.c
+++ b/gcc/crtstuff.c
@@ -1,7 +1,8 @@
 /* Specialized bits of code needed to support construction and
destruction of file-scope objects in C++ code.
Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-   2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 Free Software Foundation, 

libgo patch committed: Add mount flags, fallocate, statfs.

2012-02-17 Thread Ian Lance Taylor
This patch to libgo adds the mount flags, the GNU/Linux specific
fallocate function, and the GNU/Linux version of the statfs function.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 2b6e531380f6 libgo/configure.ac
--- a/libgo/configure.ac	Fri Feb 17 16:42:08 2012 -0800
+++ b/libgo/configure.ac	Fri Feb 17 17:12:38 2012 -0800
@@ -453,7 +453,7 @@
   ;;
 esac
 
-AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h)
+AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h)
 
 AC_CHECK_HEADERS([linux/filter.h linux/netlink.h linux/rtnetlink.h], [], [],
 [#ifdef HAVE_SYS_SOCKET_H
@@ -467,7 +467,8 @@
 AM_CONDITIONAL(HAVE_STRERROR_R, test $ac_cv_func_strerror_r = yes)
 AM_CONDITIONAL(HAVE_WAIT4, test $ac_cv_func_wait4 = yes)
 
-AC_CHECK_FUNCS(epoll_create1 faccessat fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_rm_watch mkdirat mknodat openat renameat splice tee unlinkat unshare)
+AC_CHECK_FUNCS(epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_rm_watch mkdirat mknodat openat renameat splice tee unlinkat unshare)
+AC_TYPE_OFF_T
 AC_CHECK_TYPES([loff_t])
 
 CFLAGS_hold=$CFLAGS
diff -r 2b6e531380f6 libgo/go/syscall/libcall_linux.go
--- a/libgo/go/syscall/libcall_linux.go	Fri Feb 17 16:42:08 2012 -0800
+++ b/libgo/go/syscall/libcall_linux.go	Fri Feb 17 17:12:38 2012 -0800
@@ -178,9 +178,8 @@
 //sys	Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
 //faccessat(dirfd int, pathname *byte, mode int, flags int) int
 
-// FIXME: Only in glibc 2.10 and later.
-// //sys	Fallocate(fd int, mode uint32, off int64, len int64) (err error)
-// //fallocate(fd int, mode int, offset Offset_t, len Offset_t) int
+//sys	Fallocate(fd int, mode uint32, off int64, len int64) (err error)
+//fallocate(fd int, mode int, offset Offset_t, len Offset_t) int
 
 //sys	Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
 //fchmodat(dirfd int, pathname *byte, mode Mode_t, flags int) int
@@ -191,9 +190,8 @@
 //sys	Flock(fd int, how int) (err error)
 //flock(fd int, how int) int
 
-// FIXME: mksysinfo statfs
-// //sys	Fstatfs(fd int, buf *Statfs_t) (err error)
-// //fstatfs(fd int, buf *Statfs_t) int
+//sys	Fstatfs(fd int, buf *Statfs_t) (err error)
+//fstatfs(fd int, buf *Statfs_t) int
 
 func Gettid() (tid int) {
 	r1, _, _ := Syscall(SYS_GETTID, 0, 0, 0)
@@ -283,9 +281,8 @@
 	return
 }
 
-// FIXME: mksysinfo statfs
-// //sys	Statfs(path string, buf *Statfs_t) (err error)
-// //statfs(path *byte, buf *Statfs_t) int
+//sys	Statfs(path string, buf *Statfs_t) (err error)
+//statfs(path *byte, buf *Statfs_t) int
 
 // FIXME: Only in glibc 2.6 and later.
 // //sys	SyncFileRange(fd int, off int64, n int64, flags int) (err error)
diff -r 2b6e531380f6 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Fri Feb 17 16:42:08 2012 -0800
+++ b/libgo/mksysinfo.sh	Fri Feb 17 17:12:38 2012 -0800
@@ -93,6 +93,15 @@
 #if defined(HAVE_NET_IF_H)
 #include net/if.h
 #endif
+#if defined(HAVE_SYS_MOUNT_H)
+#include sys/mount.h
+#endif
+#if defined(HAVE_SYS_VFS_H)
+#include sys/vfs.h
+#endif
+#if defined(HAVE_STATFS_H)
+#include sys/statfs.h
+#endif
 
 /* Constants that may only be defined as expressions on some systems,
expressions too complex for -fdump-go-spec to handle.  These are
@@ -766,4 +775,35 @@
 	sed -e 's/^\(const \)_\([^=]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
 done
 
+# The mount flags
+grep '^const _MS_' gen-sysinfo.go |
+sed -e 's/^\(const \)_\(MS_[^= ]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
+
+# The fallocate flags.
+grep '^const _FALLOC_' gen-sysinfo.go |
+sed -e 's/^\(const \)_\(FALLOC_[^= ]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
+
+# The statfs struct.
+# Prefer largefile variant if available.
+statfs=`grep '^type _statfs64 ' gen-sysinfo.go || true`
+if test $statfs != ; then
+  grep '^type _statfs64 ' gen-sysinfo.go
+else
+  grep '^type _statfs ' gen-sysinfo.go
+fi | sed -e 's/type _statfs64/type Statfs_t/' \
+	 -e 's/type _statfs/type Statfs_t/' \
+	 -e 's/f_type/Type/' \
+	 -e 's/f_bsize/Bsize/' \
+	 -e 's/f_blocks/Blocks/' \
+	 -e 's/f_bfree/Bfree/' \
+	 -e 's/f_bavail/Bavail/' \
+	 -e 's/f_files/Files/' \
+	 -e 's/f_ffree/Ffree/' \
+	 -e 's/f_fsid/Fsid/' \
+	 -e 's/f_namelen/Namelen/' \
+	 -e 's/f_frsize/Frsize/' \
+	 -e 's/f_flags/Flags/' \
+	 -e 's/f_spare/Spare/' \
+ ${OUT}
+
 exit $?
diff -r 2b6e531380f6 libgo/runtime/go-nosys.c
--- a/libgo/runtime/go-nosys.c	Fri Feb 17 16:42:08 2012 -0800
+++ b/libgo/runtime/go-nosys.c	Fri Feb 17 17:12:38 2012 -0800
@@ -48,6 +48,18 @@
 }
 #endif
 
+#ifndef HAVE_FALLOCATE
+int
+fallocate (int fd __attribute__ ((unused)),
+	   int mode __attribute__ ((unused)),
+	   off_t offset __attribute __ ((unused)),
+	   off_t len __attribute__ ((unused)))

Re: [patch, committed] invoke.texi: big-endian, little-endian

2012-02-17 Thread Robert Dewar

On 2/17/2012 8:00 PM, Sandra Loosemore wrote:

I've checked in this patch to consistently hyphenate big-endian and
little-endian when used as adjectives.  I observe that Jonathan Swift
also hyphenated Big-endians when used as a noun in Gulliver's Travels,
but I did not see any uses of either term as a noun in invoke.texi, so
thankfully I did not have to deal with that case.  ;-)


I can't see any legitimate case of the terms referring to bit ordering
being nouns, they are always adjectives. In Swift, when it is used as
a noun, it refers to the followers, and that just doesn't apply to the
computer use.

Odd note of interest, the project to build a big-endian version of
Windows was called Hiawatha (= big indian) :-)


[patch, committed] invoke.texi: GCC coding conventions issues

2012-02-17 Thread Sandra Loosemore
I've checked in this patch to address several nits mentioned on the GCC 
coding conventions web page


http://gcc.gnu.org/codingconventions.html

Specific tweaks made in this patch include:
* American spelling
* back end/front end
* bit-field
* enumerated type
* epilogue/prologue
* lowercase/uppercase

-Sandra


2012-02-17  Sandra Loosemore  san...@codesourcery.com

gcc/
* doc/invoke.texi: Minor copy-edits to bring into conformance with
GCC coding conventions.

Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi	(revision 184364)
+++ gcc/doc/invoke.texi	(working copy)
@@ -2128,11 +2128,11 @@ This information is generally only usefu
 @item -fstrict-enums
 @opindex fstrict-enums
 Allow the compiler to optimize using the assumption that a value of
-enumeration type can only be one of the values of the enumeration (as
+enumerated type can only be one of the values of the enumeration (as
 defined in the C++ standard; basically, a value that can be
 represented in the minimum number of bits needed to represent all the
 enumerators).  This assumption may not be valid if the program uses a
-cast to convert an arbitrary integer value to the enumeration type.
+cast to convert an arbitrary integer value to the enumerated type.
 
 @item -ftemplate-depth=@var{n}
 @opindex ftemplate-depth
@@ -3738,20 +3738,20 @@ Possibly useful when higher levels
 do not warn but -fstrict-aliasing still breaks the code, as it has very few
 false negatives.  However, it has many false positives.
 Warns for all pointer conversions between possibly incompatible types,
-even if never dereferenced.  Runs in the frontend only.
+even if never dereferenced.  Runs in the front end only.
 
 Level 2: Aggressive, quick, not too precise.
 May still have many false positives (not as many as level 1 though),
 and few false negatives (but possibly more than level 1).
 Unlike level 1, it only warns when an address is taken.  Warns about
-incomplete types.  Runs in the frontend only.
+incomplete types.  Runs in the front end only.
 
 Level 3 (default for @option{-Wstrict-aliasing}):
 Should have very few false positives and few false
 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
-Takes care of the common pun+dereference pattern in the frontend:
+Takes care of the common pun+dereference pattern in the front end:
 @code{*(int*)some_float}.
-If optimization is enabled, it also runs in the backend, where it deals
+If optimization is enabled, it also runs in the back end, where it deals
 with multiple statement cases using flow-sensitive points-to information.
 Only warns when the converted pointer is dereferenced.
 Does not warn about incomplete types.
@@ -4212,7 +4212,7 @@ while} statement.  This warning is also 
 @item -Wenum-compare
 @opindex Wenum-compare
 @opindex Wno-enum-compare
-Warn about a comparison between values of different enum types. In C++
+Warn about a comparison between values of different enumerated types. In C++
 this warning is enabled by default.  In C this warning is enabled by
 @option{-Wall}.
 
@@ -4223,7 +4223,7 @@ Warn if a @code{goto} statement or a @co
 forward across the initialization of a variable, or jumps backward to a
 label after the variable has been initialized.  This only warns about
 variables that are initialized when they are declared.  This warning is
-only supported for C and Objective C; in C++ this sort of branch is an
+only supported for C and Objective-C; in C++ this sort of branch is an
 error in any case.
 
 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
@@ -5432,7 +5432,7 @@ Dump after post-reload optimizations.
 
 @itemx -fdump-rtl-pro_and_epilogue
 @opindex fdump-rtl-pro_and_epilogue
-Dump after generating the function pro and epilogues.
+Dump after generating the function prologues and epilogues.
 
 @item -fdump-rtl-regmove
 @opindex fdump-rtl-regmove
@@ -8599,7 +8599,7 @@ The limit specifying really large functi
 limit after inlining, inlining is constrained by
 @option{--param large-function-growth}.  This parameter is useful primarily
 to avoid extreme compilation time caused by non-linear algorithms used by the
-backend.
+back end.
 The default value is 2700.
 
 @item large-function-growth
@@ -8716,7 +8716,7 @@ of huge functions.  The default value is
 
 @item max-tail-merge-comparisons
 The maximum amount of similar bbs to compare a bb with.  This is used to
-avoid quadratic behaviour in tree tail merging.  The default value is 10.
+avoid quadratic behavior in tree tail merging.  The default value is 10.
 
 @item max-tail-merge-iterations
 The maximum amount of iterations of the pass over the function.  This is used to
@@ -10585,7 +10585,7 @@ configurations this option is meaningles
 
 @item -mno-sched-prolog
 @opindex mno-sched-prolog
-Prevent the reordering of instructions in the function prolog, or the
+Prevent the reordering of instructions in the 

Re: [google/gcc-4_6_2-mobile] PATCH: PR other/46770: Replace .ctors/.dtors with .init_array/.fini_array on targets supporting them

2012-02-17 Thread Jing Yu
OK. Thanks for porting the patch.
I will commit the patch into google/gcc-4_6_2-mobile for you.

I would also like to commit it into google/gcc-4_6 branch if all tests
pass. This patch is almost the same as Google Ref 47894.

Thanks,
Jing

On Fri, Feb 17, 2012 at 5:20 PM, H.J. Lu hongjiu...@intel.com wrote:
 Hi,

 This patch backports the fix from trunk:

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

 for google/gcc-4_6_2-mobile branch.  This is needed to support C++
 global constructors/destructiors on Android/x86.  OK for
 google/gcc-4_6_2-mobile branch?

 Thanks.

 H.J.
 ---
 2011-08-20  H.J. Lu  hongjiu...@intel.com

        PR other/46770
        * config.gcc (tm_file): Add initfini-array.h if
        .init_arrary/.fini_array are supported.

        * crtstuff.c: Don't generate .ctors nor .dtors sections if
        USE_INITFINI_ARRAY is defined.

        * output.h (default_elf_init_array_asm_out_constructor): New.
        (default_elf_fini_array_asm_out_destructor): Likewise.
        * varasm.c (elf_init_array_section): Likewise.
        (elf_fini_array_section): Likewise.
        (get_elf_initfini_array_priority_section): Likewise.
        (default_elf_init_array_asm_out_constructor): Likewise.
        (default_elf_fini_array_asm_out_destructor): Likewise.

        * config/initfini-array.h: New.

 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177933 
 138bc75d-0d04-0410-961f-82ee72b054a4

 Conflicts:

        gcc/ChangeLog
 ---
  gcc/ChangeLog.hjl           |   21 +++
  gcc/config.gcc              |    5 +++
  gcc/config/initfini-array.h |   37 +++
  gcc/crtstuff.c              |   11 +++-
  gcc/output.h                |    2 +
  gcc/varasm.c                |   58 
 +++
  6 files changed, 133 insertions(+), 1 deletions(-)
  create mode 100644 gcc/ChangeLog.hjl
  create mode 100644 gcc/config/initfini-array.h

 diff --git a/gcc/ChangeLog.hjl b/gcc/ChangeLog.hjl
 new file mode 100644
 index 000..3527b27
 --- /dev/null
 +++ b/gcc/ChangeLog.hjl
 @@ -0,0 +1,21 @@
 +2011-12-07  H.J. Lu  hongjiu...@intel.com
 +
 +       Backport from mainline
 +       2011-08-20  H.J. Lu  hongjiu...@intel.com
 +
 +       PR other/46770
 +       * config.gcc (tm_file): Add initfini-array.h if
 +       .init_arrary/.fini_array are supported.
 +
 +       * crtstuff.c: Don't generate .ctors nor .dtors sections if
 +       USE_INITFINI_ARRAY is defined.
 +
 +       * output.h (default_elf_init_array_asm_out_constructor): New.
 +       (default_elf_fini_array_asm_out_destructor): Likewise.
 +       * varasm.c (elf_init_array_section): Likewise.
 +       (elf_fini_array_section): Likewise.
 +       (get_elf_initfini_array_priority_section): Likewise.
 +       (default_elf_init_array_asm_out_constructor): Likewise.
 +       (default_elf_fini_array_asm_out_destructor): Likewise.
 +
 +       * config/initfini-array.h: New.
 diff --git a/gcc/config.gcc b/gcc/config.gcc
 index d9ac0fa..b386424 100644
 --- a/gcc/config.gcc
 +++ b/gcc/config.gcc
 @@ -3176,6 +3176,11 @@ if test x$with_schedule = x; then
        esac
  fi

 +# Support --enable-initfini-array.
 +if test x$enable_initfini_array = xyes; then
 +  tm_file=${tm_file} initfini-array.h
 +fi
 +
  # Validate and mark as valid any --with options supported
  # by this target.  In order to use a particular --with option
  # you must list it in supported_defaults; validating the value
 diff --git a/gcc/config/initfini-array.h b/gcc/config/initfini-array.h
 new file mode 100644
 index 000..8aaadf6
 --- /dev/null
 +++ b/gcc/config/initfini-array.h
 @@ -0,0 +1,37 @@
 +/* Definitions for ELF systems with .init_array/.fini_array section
 +   support.
 +   Copyright (C) 2011
 +   Free Software Foundation, Inc.
 +
 +   This file is part of GCC.
 +
 +   GCC is free software; you can redistribute it and/or modify it
 +   under the terms of the GNU General Public License as published
 +   by the Free Software Foundation; either version 3, or (at your
 +   option) any later version.
 +
 +   GCC is distributed in the hope that it will be useful, but 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 GCC; see the file COPYING3.  If not see
 +   http://www.gnu.org/licenses/.  */
 +
 +#define USE_INITFINI_ARRAY
 +
 +#undef INIT_SECTION_ASM_OP
 +#undef FINI_SECTION_ASM_OP
 +
 +#undef INIT_ARRAY_SECTION_ASM_OP
 +#define INIT_ARRAY_SECTION_ASM_OP
 +
 +#undef FINI_ARRAY_SECTION_ASM_OP
 +#define FINI_ARRAY_SECTION_ASM_OP
 +
 +/* Use .init_array/.fini_array section for constructors and destructors. */
 +#undef TARGET_ASM_CONSTRUCTOR
 +#define TARGET_ASM_CONSTRUCTOR default_elf_init_array_asm_out_constructor
 +#undef TARGET_ASM_DESTRUCTOR
 +#define TARGET_ASM_DESTRUCTOR