Re: fix for 48208 and 48260 on darwin

2011-03-28 Thread IainS

Hi Christian,

On 28 Mar 2011, at 04:55, Christian Schüler wrote:


F
-C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path  
after %qs)
+Driver C ObjC C++ ObjC++ Joined Separate MissingArgError(missing  
path after \

%qs)
-F dir  Add dir to the end of the main framework include path


This looks right (but I cannot approve it).

+++ gcc-4.6.0-RC-20110321-patched/gcc/config/darwin-driver.c	 
2011-03-26

07:01:02.0 +0100
@@ -161,6 +161,13 @@
continue;
  switch ((*decoded_options)[i].opt_index)
{
+#if DARWIN_X86
+   case OPT_arch:
+ if (!strcmp ((*decoded_options)[i].arg, i386))
+		generate_option (OPT_m32, NULL, 1, CL_DRIVER, (*decoded_options) 
[i]);

+ else if (!strcmp ((*decoded_options)[i].arg, x86_64))
+		generate_option (OPT_m64, NULL, 1, CL_DRIVER, (*decoded_options) 
[i]);

+ break;
+#endif


Hm - this doesn't quite cover the scenario - what about people using  
GCC on powerpc*-darwin9?

(or people on x86-darwin10 targeting powerpc on darwin9)?

Normally, the arch option is recognized (and swallowed) by the  
Apple way 'driverdriver.c' program which then emits the right driver  
lines for the arch (and deals with cross-compiler lines for ppc).


driverdriver.c is available from the Apple Local GCC open source  
releases (e.g. http://opensource.apple.com/source/gcc/gcc-5646/driverdriver.c)

- it's at the top of the source tree
- it builds OK against gcc-4.5 headers  - which is OK, since it's a  
stand-alone program that just manipulates command lines (doesn't  
compile against gcc-4.6 headers because of the changes in option  
handling)


[I guess someone should cook up one for gcc/contrib that works with  
our new system].


One then builds the {ppc,x86}-apple-darwin* compilers, installs them  
and you have a working set that does the Apple way layer on top of  
GCC.


This works (at least a few weeks ago) - since I managed to get pre- 
release 4.6 going within XCode - but needs a couple more small patches  
to deal with other options.


---

-- ping me off list, if you would like to try this and I'll try and  
send more detailed instructions and a couple of additional patches  
that are work in progress ... 


--

however, I can neither approve nor reject your patches ;-)
cheers
Iain



[patch ada]: Fix issues about multilib build of native windows and handle MSG_WAITALL for windows native targets

2011-03-28 Thread Kai Tietz
Hello,

this patch fixes some nits about MSG_WAITALL for mingw(-w64) targets.
Additionally it improves multilib configury for windows native
targets.

ChangeLog gcc/ada

2011-03-28  Kai Tietz

* raise-gcc.c (PERSONALITY_FUNCTION): Add prototype to
prevent warning.
* g-socthi-mingw.adb (C_Recvmsg): Handle MSG_WAITALL for
windows native targets.
* s-oscons-tmplt.c (MSG_WAITALL): Define it for native windows
targets to flag value.
* gcc-interface/Makefile.in (SO_LIB): Handle multilib build for native
windows targets.
(EH_MECHANISM): Make sure we use gcc's exception mechanism for 64-bit
native windows target.

Tested for x86_64-w64-mingw32 and i686-w64-mingw32 targets. Ok for apply?

Regards,
Kai
Index: gcc/gcc/ada/g-socthi-mingw.adb
===
--- gcc.orig/gcc/ada/g-socthi-mingw.adb 2010-09-09 16:07:42.0 +0200
+++ gcc/gcc/ada/g-socthi-mingw.adb  2011-03-28 09:42:45.039326300 +0200
@@ -277,7 +277,8 @@ package body GNAT.Sockets.Thin is
   use type C.size_t;
 
   Fill  : constant Boolean :=
-(C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
+SOSC.MSG_WAITALL /= -1
+and then (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
   --  Is the MSG_WAITALL flag set? If so we need to fully fill all vectors
 
   Res   : C.int;
Index: gcc/gcc/ada/gcc-interface/Makefile.in
===
--- gcc.orig/gcc/ada/gcc-interface/Makefile.in  2011-03-28 09:27:19.0 
+0200
+++ gcc/gcc/ada/gcc-interface/Makefile.in   2011-03-28 09:26:53.759029000 
+0200
@@ -1638,17 +1638,23 @@ ifeq ($(strip $(filter-out cygwin32% min
   ifeq ($(strip $(MULTISUBDIR)),/32)
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw.ads
+   SO_OPTS= -m32 -Wl,-soname,
   else
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw-x86_64.ads
+   EH_MECHANISM=-gcc
+   SO_OPTS = -m64 -Wl,-soname,
   endif
 else
   ifeq ($(strip $(MULTISUBDIR)),/64)
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw-x86_64.ads
+   EH_MECHANISM=-gcc
+   SO_OPTS = -m64 -Wl,-soname,
   else
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw.ads
+   SO_OPTS = -m32 -Wl,-soname,
   endif
 endif
 
Index: gcc/gcc/ada/raise-gcc.c
===
--- gcc.orig/gcc/ada/raise-gcc.c2010-10-28 22:36:06.0 +0200
+++ gcc/gcc/ada/raise-gcc.c 2011-03-28 09:11:43.053384100 +0200
@@ -1065,6 +1065,11 @@ typedef _Unwind_Action phases_arg_t;
 #endif
 
 _Unwind_Reason_Code
+PERSONALITY_FUNCTION (version_arg_t, phases_arg_t,
+  _Unwind_Exception_Class, _Unwind_Exception *,
+  _Unwind_Context *);
+
+_Unwind_Reason_Code
 PERSONALITY_FUNCTION (version_arg_t version_arg,
   phases_arg_t phases_arg,
   _Unwind_Exception_Class uw_exception_class,
Index: gcc/gcc/ada/s-oscons-tmplt.c
===
--- gcc.orig/gcc/ada/s-oscons-tmplt.c   2010-12-24 11:41:57.0 +0100
+++ gcc/gcc/ada/s-oscons-tmplt.c2011-03-28 09:15:39.683932300 +0200
@@ -1084,6 +1084,10 @@ CND(MSG_PEEK, Peek at incoming data)
 CND(MSG_EOR, Send end of record)
 
 #ifndef MSG_WAITALL
+#ifdef __MINWGW32__
+/* We use it on windows native targets, so set to flag value.  */
+# define MSG_WAITALL (1  2)
+#else
 # define MSG_WAITALL -1
 #endif
 CND(MSG_WAITALL, Wait for full reception)


Re: [patch] Fix SSA corruption with SLP

2011-03-28 Thread Eric Botcazou
 GSI?

All the other functions of the vectorizer still have BSI in the comments. ;-)

 OK for the mainline otherwise.

Thanks!

-- 
Eric Botcazou


Re: [patch ada]: Fix issues about multilib build of native windows and handle MSG_WAITALL for windows native targets

2011-03-28 Thread Kai Tietz
2011/3/28 Arnaud Charlet char...@adacore.com:
 this patch fixes some nits about MSG_WAITALL for mingw(-w64) targets.
 Additionally it improves multilib configury for windows native
 targets.

 Can you please split this patch in two, since the MSG_WAITALL is one thing,
 and the multilib is a completely different patch.

Hello Arno,

I split patch into two. ada_w_multi.txt contains just the
gcc-interface/Makefile.in change and the ada_wt.txt the MSG_WAITALL
patch.

ChangeLog gcc/ada (ada_wt.txt)

2011-03-28  Kai Tietz

* raise-gcc.c (PERSONALITY_FUNCTION): Add prototype to
prevent warning.
* g-socthi-mingw.adb (C_Recvmsg): Handle MSG_WAITALL for
windows native targets.
* s-oscons-tmplt.c (MSG_WAITALL): Define it for native windows
targets to flag value.

ChangeLog gcc/ada (ada_w_multi.txt)

2011-03-28  Kai Tietz

* gcc-interface/Makefile.in (SO_LIB): Handle multilib build for native
windows targets.
(EH_MECHANISM): Make sure we use gcc's exception mechanism for 64-bit
native windows target.


 Also, can you explain the setting of SO_LIB in more details?

The issue is that on creation of .dll the linker has to know for
multilib for which target it should work. By specifying to frontend
the -m32/-m64 the internal spec-file takes care that proper options
are passed to ld.

 Concerning the setting of EH_MECHANISM, it's time to set ZCX to True by
 default on Windows 32bits as well, and set EH_MECHANISM=-gcc on all
 Windows variants IMO.

Well, here I am not that sure.  As mingw.org is still using the
dw2-unwinding, but there is also the sjlj one, I am a bit concerned to
make EH_MECHANISM=-gcc default. Same is the case for the ZCX flag, but
I might overlook here something obvious.

Regards,
Kai
Index: gcc/gcc/ada/gcc-interface/Makefile.in
===
--- gcc.orig/gcc/ada/gcc-interface/Makefile.in  2011-03-28 10:29:44.0 
+0200
+++ gcc/gcc/ada/gcc-interface/Makefile.in   2011-03-28 10:32:28.890727300 
+0200
@@ -1638,17 +1638,23 @@ ifeq ($(strip $(filter-out cygwin32% min
   ifeq ($(strip $(MULTISUBDIR)),/32)
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw.ads
+   SO_OPTS= -m32 -Wl,-soname,
   else
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw-x86_64.ads
+   EH_MECHANISM=-gcc
+   SO_OPTS = -m64 -Wl,-soname,
   endif
 else
   ifeq ($(strip $(MULTISUBDIR)),/64)
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw-x86_64.ads
+   EH_MECHANISM=-gcc
+   SO_OPTS = -m64 -Wl,-soname,
   else
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw.ads
+   SO_OPTS = -m32 -Wl,-soname,
   endif
 endif
 
Index: gcc/gcc/ada/g-socthi-mingw.adb
===
--- gcc.orig/gcc/ada/g-socthi-mingw.adb 2010-09-09 16:07:42.0 +0200
+++ gcc/gcc/ada/g-socthi-mingw.adb  2011-03-28 09:42:45.039326300 +0200
@@ -277,7 +277,8 @@ package body GNAT.Sockets.Thin is
   use type C.size_t;
 
   Fill  : constant Boolean :=
-(C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
+SOSC.MSG_WAITALL /= -1
+and then (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
   --  Is the MSG_WAITALL flag set? If so we need to fully fill all vectors
 
   Res   : C.int;
Index: gcc/gcc/ada/raise-gcc.c
===
--- gcc.orig/gcc/ada/raise-gcc.c2010-10-28 22:36:06.0 +0200
+++ gcc/gcc/ada/raise-gcc.c 2011-03-28 09:11:43.053384100 +0200
@@ -1065,6 +1065,11 @@ typedef _Unwind_Action phases_arg_t;
 #endif
 
 _Unwind_Reason_Code
+PERSONALITY_FUNCTION (version_arg_t, phases_arg_t,
+  _Unwind_Exception_Class, _Unwind_Exception *,
+  _Unwind_Context *);
+
+_Unwind_Reason_Code
 PERSONALITY_FUNCTION (version_arg_t version_arg,
   phases_arg_t phases_arg,
   _Unwind_Exception_Class uw_exception_class,
Index: gcc/gcc/ada/s-oscons-tmplt.c
===
--- gcc.orig/gcc/ada/s-oscons-tmplt.c   2010-12-24 11:41:57.0 +0100
+++ gcc/gcc/ada/s-oscons-tmplt.c2011-03-28 09:15:39.683932300 +0200
@@ -1084,6 +1084,10 @@ CND(MSG_PEEK, Peek at incoming data)
 CND(MSG_EOR, Send end of record)
 
 #ifndef MSG_WAITALL
+#ifdef __MINWGW32__
+/* We use it on windows native targets, so set to flag value.  */
+# define MSG_WAITALL (1  2)
+#else
 # define MSG_WAITALL -1
 #endif
 CND(MSG_WAITALL, Wait for full reception)


Re: [2/2] Reducing the overhead of dwarf2 location tracking

2011-03-28 Thread Matthias Klose
On 05.03.2011 15:37, Richard Sandiford wrote:
 Jakub Jelinek ja...@redhat.com writes:
 On Fri, Mar 04, 2011 at 01:56:55PM +, Richard Sandiford wrote:
 * dwarf2out.c (dw_loc_list_node): Add resolved_addr and replaced.
 (cached_dw_loc_list_def): New structure.
 (cached_dw_loc_list): New typedef.
 (cached_dw_loc_list_table): New variable.
 (cached_dw_loc_list_table_hash): New function.
 (cached_dw_loc_list_table_eq): Likewise.
 (add_location_or_const_value_attribute): Take a bool cache_p.
 Cache the list when the parameter is true.
 (gen_formal_parameter_die): Update caller.
 (gen_variable_die): Likewise.
 (dwarf2out_finish): Likewise.
 (dwarf2out_function_decl): Clear cached_dw_loc_list_table.
 (dwarf2out_init): Initialize cached_dw_loc_list_table.
 (resolve_addr): Cache the result of resolving a chain of
 location lists.

 I think you should handle the cached_dw_loc_list_table in
 dwarf2out_abstract_function similarly to say decl_loc_table, i.e.
 save/clear for the duration of the of recursive dwarf2out_decl
 call, restore afterwards and in the places where you actually use
 it guard it also with cached_dw_loc_list_table != NULL.
 
 OK, thanks for the pointer.  How does this look?  Bootstrapped
  regression-tested on x86_64-linux-gnu.

tested with 4.6.0 on x86, x86_64 and arm-linux-genueabi without seeing 
regressions.

  Matthias


PING^3: Reducing the overhead of dwarf2 location tracking

2011-03-28 Thread Richard Sandiford
Third ping for this patch for PR48190 (4.5+):

http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00255.html

It fixes a source of quadratic memory use while generating dwarf2
var-tracking information.

Thanks,
Richard


Re: [patch ada]: Fix issues about multilib build of native windows and handle MSG_WAITALL for windows native targets

2011-03-28 Thread Kai Tietz
2011/3/28 Kai Tietz ktiet...@googlemail.com:

 ChangeLog gcc/ada (ada_wt.txt)

 2011-03-28  Kai Tietz

        * raise-gcc.c (PERSONALITY_FUNCTION): Add prototype to
        prevent warning.
        * g-socthi-mingw.adb (C_Recvmsg): Handle MSG_WAITALL for
        windows native targets.
        * s-oscons-tmplt.c (MSG_WAITALL): Define it for native windows
        targets to flag value.

Just noticed I had a wrong shift-value for MSG_WAITALL. It should be
8. Updated patch attached.

Kai
Index: gcc/gcc/ada/g-socthi-mingw.adb
===
--- gcc.orig/gcc/ada/g-socthi-mingw.adb 2010-09-09 16:07:42.0 +0200
+++ gcc/gcc/ada/g-socthi-mingw.adb  2011-03-28 09:42:45.039326300 +0200
@@ -277,7 +277,8 @@ package body GNAT.Sockets.Thin is
   use type C.size_t;
 
   Fill  : constant Boolean :=
-(C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
+SOSC.MSG_WAITALL /= -1
+and then (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
   --  Is the MSG_WAITALL flag set? If so we need to fully fill all vectors
 
   Res   : C.int;
Index: gcc/gcc/ada/raise-gcc.c
===
--- gcc.orig/gcc/ada/raise-gcc.c2010-10-28 22:36:06.0 +0200
+++ gcc/gcc/ada/raise-gcc.c 2011-03-28 09:11:43.053384100 +0200
@@ -1065,6 +1065,11 @@ typedef _Unwind_Action phases_arg_t;
 #endif
 
 _Unwind_Reason_Code
+PERSONALITY_FUNCTION (version_arg_t, phases_arg_t,
+  _Unwind_Exception_Class, _Unwind_Exception *,
+  _Unwind_Context *);
+
+_Unwind_Reason_Code
 PERSONALITY_FUNCTION (version_arg_t version_arg,
   phases_arg_t phases_arg,
   _Unwind_Exception_Class uw_exception_class,
Index: gcc/gcc/ada/s-oscons-tmplt.c
===
--- gcc.orig/gcc/ada/s-oscons-tmplt.c   2010-12-24 11:41:57.0 +0100
+++ gcc/gcc/ada/s-oscons-tmplt.c2011-03-28 09:15:39.683932300 +0200
@@ -1084,6 +1084,10 @@ CND(MSG_PEEK, Peek at incoming data)
 CND(MSG_EOR, Send end of record)
 
 #ifndef MSG_WAITALL
+#ifdef __MINWGW32__
+/* We use it on windows native targets, so set to flag value.  */
+# define MSG_WAITALL (1  3)
+#else
 # define MSG_WAITALL -1
 #endif
 CND(MSG_WAITALL, Wait for full reception)


[patch] Fix bogus source locations with optimization

2011-03-28 Thread Eric Botcazou
Hi,

when optimization is enabled, especially -O2 and above, you can have lines in 
the assembly file with really bogus source location info.  The scenario is as 
follows: an optimization pass at the Tree level (typically PRE) creates a new 
statement and inserts it at some place in the dominator tree, creating a new 
basic block; this statement is (rightfully) given unknown location.  When 
RTL is being expanded, this statement inherits the current source location, 
which is the location of the last statement of the previous basic block.  Then 
basic block reordering kicks in and the statement is moved to another place, 
still carrying the inherited source location down to the assembly file.

The proposed fix is to allow RTL statements to have unknown location (zero 
locator) like Tree statements.  They of course will be assigned the current 
source location but only in the assembly file, thus becoming sort of silent.

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


2011-03-28  Eric Botcazou  ebotca...@adacore.com

* cfgexpand.c (expand_gimple_cond): Always set the source location and
block before expanding the statement.
(expand_gimple_stmt_1): Likewise.  Set them here...
(expand_gimple_stmt): ...and not here.  Tidy.
* cfglayout.c (curr_insn_locator): Return 0 if the current location is
unknown.


-- 
Eric Botcazou
Index: cfgexpand.c
===
--- cfgexpand.c	(revision 171572)
+++ cfgexpand.c	(working copy)
@@ -1745,11 +1745,8 @@ expand_gimple_cond (basic_block bb, gimp
   last2 = last = get_last_insn ();
 
   extract_true_false_edges_from_block (bb, true_edge, false_edge);
-  if (gimple_has_location (stmt))
-{
-  set_curr_insn_source_location (gimple_location (stmt));
-  set_curr_insn_block (gimple_block (stmt));
-}
+  set_curr_insn_source_location (gimple_location (stmt));
+  set_curr_insn_block (gimple_block (stmt));
 
   /* These flags have no purpose in RTL land.  */
   true_edge-flags = ~EDGE_TRUE_VALUE;
@@ -1896,6 +1893,10 @@ static void
 expand_gimple_stmt_1 (gimple stmt)
 {
   tree op0;
+
+  set_curr_insn_source_location (gimple_location (stmt));
+  set_curr_insn_block (gimple_block (stmt));
+
   switch (gimple_code (stmt))
 {
 case GIMPLE_GOTO:
@@ -2052,32 +2053,21 @@ expand_gimple_stmt_1 (gimple stmt)
 static rtx
 expand_gimple_stmt (gimple stmt)
 {
-  int lp_nr = 0;
-  rtx last = NULL;
   location_t saved_location = input_location;
+  rtx last = get_last_insn ();
+  int lp_nr;
 
-  last = get_last_insn ();
-
-  /* If this is an expression of some kind and it has an associated line
- number, then emit the line number before expanding the expression.
-
- We need to save and restore the file and line information so that
- errors discovered during expansion are emitted with the right
- information.  It would be better of the diagnostic routines
- used the file/line information embedded in the tree nodes rather
- than globals.  */
   gcc_assert (cfun);
 
+  /* We need to save and restore the current source location so that errors
+ discovered during expansion are emitted with the right location.  But
+ it would be better if the diagnostic routines used the source location
+ embedded in the tree nodes rather than globals.  */
   if (gimple_has_location (stmt))
-{
-  input_location = gimple_location (stmt);
-  set_curr_insn_source_location (input_location);
-
-  /* Record where the insns produced belong.  */
-  set_curr_insn_block (gimple_block (stmt));
-}
+input_location = gimple_location (stmt);
 
   expand_gimple_stmt_1 (stmt);
+
   /* Free any temporaries used to evaluate this statement.  */
   free_temp_slots ();
 
Index: cfglayout.c
===
--- cfglayout.c	(revision 171572)
+++ cfglayout.c	(working copy)
@@ -323,7 +323,7 @@ get_curr_insn_block (void)
 int
 curr_insn_locator (void)
 {
-  if (curr_rtl_loc == -1)
+  if (curr_rtl_loc == -1 || curr_location == UNKNOWN_LOCATION)
 return 0;
   if (last_block != curr_block)
 {


Re: [RFC PATCH] Typed DWARF stack

2011-03-28 Thread Jakub Jelinek
On Fri, Mar 25, 2011 at 09:44:40AM -0700, Roland McGrath wrote:
 It's been a while since I read Cary's proposal, and I am no longer
 likely to do much work of my own in this area.  So I'll just respond at
 the high level.
 
 I like very much the essential notion of the stack being of typed
 entities with no specification of how the consumer actually implements
 it.  In particular, this also brings implicit-pointer into the fold as a
 new type of a stack element, i.e. imaginary pointer.  Obviously only
 the operations that amount to addition/subtraction with an integer
 actually make sense on such a stack element.  This makes the second
 operand of DW_OP(GNU_)implicit_pointer superfluous (and hence the common
 case of zero a byte smaller), since nonzero cases can just be followed
 by an appropriate DW_OP_plus_uconst or suchlike.

For DW_OP_GNU_implicit_pointer it is too late to remove the parameter now,
because e.g. GCC 4.6 has been shipped with it and several tools have support
for it already.
What we still could do is reword it based on the typed stack, say that
DW_OP_*implicit_pointer pushes an entry of a special type on the stack
and what operations are allowed with that type (from arithmetics
I think only addition of integral stack value to it (leading again to
implicit pointer type) or subtraction of two implicit pointers for the same
DIE, leading to an integral difference.  With that rewording,
DW_OP_GNU_implicit_pointer could be no longer a terminal, but could appear
within the DWARF expressions.
DW_OP_implicit_pointer can of course be designed without the operand.

 As to encoding, I have a fancy idea that I discussed off the cuff at the
 Summit with Jakub and Richard, and still quite like, though I haven't
 fleshed it out any more than I did then.  I hope to inspire someone else
 to actually want to implement it.  It's rather more ambitious than the
 things that Jakub will just add while the rest of us sleep, so I
 wouldn't suggest that such DW_OP_GNU_* extensions be delayed for this
 plan.  But perhaps it can become coherent enough and get done enough to
 seriously propose it for DWARF 5.

I view such encoding changes primarily as compression and thus IMHO
we don't need to delay any changes waiting for the compression technique
specification.  We have DW_OP_call{2,4} right now as a simple compression
technique and can (and should) improve that, but in the mean time we can
just add new ops as we'd normally do.

 As I say, I'm not really working on this stuff any more except maybe for
 (as yet wholly absent) spare time.  But, food for thought.

IMHO the typed stack as Cary proposed is usable as is, and as additional
bonus it is extensible, e.g. by saying that the referenced DIE doesn't
have to be just DW_TAG_base_type, but also this and that (where the
referenced DIE tags could newly be either current tags where we would give
it a particular meaning, or it could be some newly added tag, perhaps just
for that purpose) we could extend it easily.

Jakub


[patch ada]: Prevent warning about PERSONALITY_FUNCTION in raise-gcc.c

2011-03-28 Thread Kai Tietz
Hello,

Split submitted patch from thread [patch ada]: Fix issues about
multilib build of native windows and handle MSG_WAITALL for windows
native targets
into separate ones.

ChangeLog gcc/ada

2011-03-28  Kai Tietz

* raise-gcc.c (PERSONALITY_FUNCTION): Add prototype to
prevent warning.

Regards,
Kai
Index: gcc/gcc/ada/raise-gcc.c
===
--- gcc.orig/gcc/ada/raise-gcc.c2011-03-28 10:56:51.0 +0200
+++ gcc/gcc/ada/raise-gcc.c 2011-03-28 11:21:37.453647200 +0200
@@ -1065,6 +1065,11 @@ typedef _Unwind_Action phases_arg_t;
 #endif
 
 _Unwind_Reason_Code
+PERSONALITY_FUNCTION (version_arg_t, phases_arg_t,
+  _Unwind_Exception_Class, _Unwind_Exception *,
+  _Unwind_Context *);
+
+_Unwind_Reason_Code
 PERSONALITY_FUNCTION (version_arg_t version_arg,
   phases_arg_t phases_arg,
   _Unwind_Exception_Class uw_exception_class,


[patch ada] Use Ada output of gnatbind for building tools

2011-03-28 Thread Tristan Gingold
Hi,

gnatbind can generate Ada or C output.  The C output is being deprecated so it 
shouldn't be used to build the tools.
This patch updates the Makefiles so that the Ada output is used instead.

Ok for trunk ?

Tristan.

gcc/ada
2011-03-28  Tristan Gingold  ging...@adacore.com

* gcc-interface/Make-lang.in (ada/b_gnat1.adb):  Replaces
ada/b_gnat1.c. Use ada output of gnatbind.
(ada/b_gnatb.adb): Ditto.
(ada/b_gnat1.o, ada/b_gnatb.o): New rules.
(ada.mostlyclean, ada.stage1)
(ada.stage2, ada.stage3, ada.stage4, ada.stageprofile)
(ada.stagefeedback): Adjust.

* gcc-interface/Makefile.in (b_gnatl.adb): Replaces b_gnatl.c
Use ada output of gnatbind.
(b_gnatm.adb): Ditto.
(b_gnatl.o, b_gnatm.o): New rules.

diff --git gcc/ada/gcc-interface/Make-lang.in gcc/ada/gcc-interface/Make-lang.in
index 637a686..2c5fdf4 100644
--- gcc/ada/gcc-interface/Make-lang.in
+++ gcc/ada/gcc-interface/Make-lang.in
@@ -938,7 +938,7 @@ ada.uninstall:
 # We just have to delete files specific to us.
 
 ada.mostlyclean:
-   -$(RM) ada/*$(objext) ada/*.ali ada/b_*.c
+   -$(RM) ada/*$(objext) ada/*.ali ada/b_gnat*.ads ada/b_gnat*.adb
-$(RM) ada/*$(coverageexts)
-$(RM) ada/sdefault.adb ada/stamp-sdefault ada/stamp-snames
-$(RMDIR) ada/tools
@@ -974,22 +974,22 @@ ada.maintainer-clean:
 # The main makefile has already created stage?/ada
 
 ada.stage1: stage1-start
-   -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stage1/ada
+   -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage1/ada
-$(MV) ada/stamp-* stage1/ada
 ada.stage2: stage2-start
-   -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stage2/ada
+   -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage2/ada
-$(MV) ada/stamp-* stage2/ada
 ada.stage3: stage3-start
-   -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stage3/ada
+   -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage3/ada
-$(MV) ada/stamp-* stage3/ada
 ada.stage4: stage4-start
-   -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stage4/ada
+   -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage4/ada
-$(MV) ada/stamp-* stage4/ada
 ada.stageprofile: stageprofile-start
-   -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stageprofile/ada
+   -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stageprofile/ada
-$(MV) ada/stamp-* stageprofile/ada
 ada.stagefeedback: stagefeedback-start
-   -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stagefeedback/ada
+   -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stagefeedback/ada
-$(MV) ada/stamp-* stagefeedback/ada
 
 lang_checks += check-gnat
@@ -1086,19 +1086,28 @@ gnatstage2: force
 
 # Note that dependencies on obstack.h are not written
 # because that file is not part of GCC.
-# Dependencies on gvarargs.h are not written
-# because all that file does, when not compiling with GCC,
-# is include the system varargs.h.
 
 # Ada language specific files.
 
-ada/b_gnat1.c : $(GNAT1_ADA_OBJS)
-   $(GNATBIND) -C $(ADA_INCLUDES) -o ada/b_gnat1.c -n ada/gnat1drv.ali
-ada/b_gnat1.o : ada/b_gnat1.c
-
-ada/b_gnatb.c : $(GNATBIND_OBJS) ada/gnatbind.o ada/interfac.o
-   $(GNATBIND) -C $(ADA_INCLUDES) -o ada/b_gnatb.c ada/gnatbind.ali
-ada/b_gnatb.o : ada/b_gnatb.c
+ada/b_gnat1.adb : $(GNAT1_ADA_OBJS)
+# Old gnatbind do not allow a path for -o.
+   $(GNATBIND) $(ADA_INCLUDES) -o b_gnat1.adb -n ada/gnat1drv.ali
+   $(MV) b_gnat1.adb b_gnat1.ads ada/
+
+ada/b_gnat1.o : ada/b_gnat1.adb
+# Do not use ADAFLAGS to get rid of -gnatg which generates a lot
+# of style messages.
+   $(CC) -c $(CFLAGS) $(ADA_CFLAGS) -gnatp -gnatws $(ADA_INCLUDES) \
+   $ $(OUTPUT_OPTION)
+
+ada/b_gnatb.adb : $(GNATBIND_OBJS) ada/gnatbind.o ada/interfac.o
+# Old gnatbind do not allow a path for -o.
+   $(GNATBIND) $(ADA_INCLUDES) -o b_gnatb.adb ada/gnatbind.ali
+   $(MV) b_gnatb.adb b_gnatb.ads ada/
+
+ada/b_gnatb.o : ada/b_gnatb.adb
+   $(CC) -c $(CFLAGS) $(ADA_CFLAGS) -gnatp -gnatws $(ADA_INCLUDES) \
+   $ $(OUTPUT_OPTION)
 
 include $(srcdir)/ada/Make-generated.in
 
diff --git gcc/ada/gcc-interface/Makefile.in gcc/ada/gcc-interface/Makefile.in
index b64ba55..71c00e2 100644
--- gcc/ada/gcc-interface/Makefile.in
+++ gcc/ada/gcc-interface/Makefile.in
@@ -2687,13 +2687,19 @@ gnat-cross: force
 # because all that file does, when not compiling with GCC,
 # is include the system varargs.h.
 
-b_gnatl.c : $(GNATLINK_OBJS)
-   $(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatl.c gnatlink.ali
-b_gnatl.o : b_gnatl.c
+b_gnatl.adb : $(GNATLINK_OBJS)
+   $(GNATBIND) $(ADA_INCLUDES) -o b_gnatl.adb gnatlink.ali
 
-b_gnatm.c : $(GNATMAKE_OBJS)
-   $(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatm.c gnatmake.ali
-b_gnatm.o : b_gnatm.c
+b_gnatl.o : b_gnatl.adb
+   $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
+   $ $(OUTPUT_OPTION)
+
+b_gnatm.adb : 

[patch ada]: Fix MSG_WAITALL handling for windows native targets

2011-03-28 Thread Kai Tietz
Hello,

Split submitted patch from thread [patch ada]: Fix issues about
multilib build of native windows and handle MSG_WAITALL for windows
native targets
into separate ones.

ChangeLog gcc/ada (ada_wt.txt)

2011-03-28  Kai Tietz

* g-socthi-mingw.adb (C_Recvmsg): Handle MSG_WAITALL for
windows native targets.
* s-oscons-tmplt.c (MSG_WAITALL): Define it for native windows
targets to flag value.

Regards,
Kai
Index: gcc/gcc/ada/g-socthi-mingw.adb
===
--- gcc.orig/gcc/ada/g-socthi-mingw.adb 2010-09-09 16:07:42.0 +0200
+++ gcc/gcc/ada/g-socthi-mingw.adb  2011-03-28 09:42:45.039326300 +0200
@@ -277,7 +277,8 @@ package body GNAT.Sockets.Thin is
   use type C.size_t;
 
   Fill  : constant Boolean :=
-(C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
+SOSC.MSG_WAITALL /= -1
+and then (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
   --  Is the MSG_WAITALL flag set? If so we need to fully fill all vectors
 
   Res   : C.int;
Index: gcc/gcc/ada/s-oscons-tmplt.c
===
--- gcc.orig/gcc/ada/s-oscons-tmplt.c   2010-12-24 11:41:57.0 +0100
+++ gcc/gcc/ada/s-oscons-tmplt.c2011-03-28 09:15:39.683932300 +0200
@@ -1084,6 +1084,10 @@ CND(MSG_PEEK, Peek at incoming data)
 CND(MSG_EOR, Send end of record)
 
 #ifndef MSG_WAITALL
+#ifdef __MINWGW32__
+/* We use it on windows native targets, so set to flag value.  */
+# define MSG_WAITALL (1  3)
+#else
 # define MSG_WAITALL -1
 #endif
 CND(MSG_WAITALL, Wait for full reception)


Re: [patch ada]: Prevent warning about PERSONALITY_FUNCTION in raise-gcc.c

2011-03-28 Thread Arnaud Charlet
 Split submitted patch from thread [patch ada]: Fix issues about
 multilib build of native windows and handle MSG_WAITALL for windows
 native targets
 into separate ones.
 
 ChangeLog gcc/ada
 
 2011-03-28  Kai Tietz
 
   * raise-gcc.c (PERSONALITY_FUNCTION): Add prototype to
   prevent warning.

OK, thanks for resubmitting separately.


Re: [patch ada] Use Ada output of gnatbind for building tools

2011-03-28 Thread Arnaud Charlet
 gnatbind can generate Ada or C output.  The C output is being deprecated so it
 shouldn't be used to build the tools.
 This patch updates the Makefiles so that the Ada output is used instead.
 
 Ok for trunk ?

OK, thanks.


Re: [patch ada] Use Ada output of gnatbind for building tools

2011-03-28 Thread Eric Botcazou
 gnatbind can generate Ada or C output.  The C output is being deprecated so
 it shouldn't be used to build the tools. This patch updates the Makefiles
 so that the Ada output is used instead.

Great!  Please mention PR ada/44431 in the ChangeLog.

-- 
Eric Botcazou


[patch ada]: Fix issues about multilib build of native windows

2011-03-28 Thread Kai Tietz
Hello,

Split submitted patch from thread [patch ada]: Fix issues about
multilib build of native windows and handle MSG_WAITALL for windows
native targets
into separate ones.

ChangeLog gcc/ada (ada_w_multi.txt)

2011-03-28  Kai Tietz

* gcc-interface/Makefile.in (SO_LIB): Handle multilib build for native
windows targets.
(EH_MECHANISM): Make sure we use gcc's exception mechanism for all
native windows target.
* system-mingw.ads (System): Change ZCX_By_Default default to
True.

Regards,
Kai
Index: gcc/gcc/ada/gcc-interface/Makefile.in
===
--- gcc.orig/gcc/ada/gcc-interface/Makefile.in  2011-03-28 10:56:42.202851800 
+0200
+++ gcc/gcc/ada/gcc-interface/Makefile.in   2011-03-28 11:35:38.320423700 
+0200
@@ -1634,21 +1634,26 @@ ifeq ($(strip $(filter-out cygwin32% min
 s-osprim.adbs-osprim-mingw.adb \
 s-taprop.adbs-taprop-mingw.adb
 
+EH_MECHANISM=-gcc
 ifeq ($(strip $(filter-out x86_64%,$(arch))),)
   ifeq ($(strip $(MULTISUBDIR)),/32)
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw.ads
+   SO_OPTS= -m32 -Wl,-soname,
   else
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw-x86_64.ads
+   SO_OPTS = -m64 -Wl,-soname,
   endif
 else
   ifeq ($(strip $(MULTISUBDIR)),/64)
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw-x86_64.ads
+   SO_OPTS = -m64 -Wl,-soname,
   else
LIBGNAT_TARGET_PAIRS += \
  system.adssystem-mingw.ads
+   SO_OPTS = -m32 -Wl,-soname,
   endif
 endif
 
Index: gcc/gcc/ada/system-mingw.ads
===
--- gcc.orig/gcc/ada/system-mingw.ads   2010-09-09 16:07:48.0 +0200
+++ gcc/gcc/ada/system-mingw.ads2011-03-28 11:31:31.668102900 +0200
@@ -139,7 +139,7 @@ private
Always_Compatible_Rep : constant Boolean := False;
Suppress_Standard_Library : constant Boolean := False;
Use_Ada_Main_Program_Name : constant Boolean := False;
-   ZCX_By_Default: constant Boolean := False;
+   ZCX_By_Default: constant Boolean := True;
GCC_ZCX_Support   : constant Boolean := True;
 
---


Re: [patch ada]: Fix issues about multilib build of native windows and handle MSG_WAITALL for windows native targets

2011-03-28 Thread Kai Tietz
2011/3/28 Arnaud Charlet char...@adacore.com:
 I split patch into two. ada_w_multi.txt contains just the
 gcc-interface/Makefile.in change and the ada_wt.txt the MSG_WAITALL
 patch.

 Thanks. Actually raise-gcc.c is yet another issue.

 Could you please resubmit under three different emails/threads your
 3 different patches, so that they can be reviewed and OKed independently
 (and potentially by different people)? TIA.

 The issue is that on creation of .dll the linker has to know for
 multilib for which target it should work. By specifying to frontend
 the -m32/-m64 the internal spec-file takes care that proper options
 are passed to ld.

 Thanks for the clarification.

  Concerning the setting of EH_MECHANISM, it's time to set ZCX to True by
  default on Windows 32bits as well, and set EH_MECHANISM=-gcc on all
  Windows variants IMO.

 Well, here I am not that sure.  As mingw.org is still using the
 dw2-unwinding, but there is also the sjlj one, I am a bit concerned to
 make EH_MECHANISM=-gcc default. Same is the case for the ZCX flag, but
 I might overlook here something obvious.

 We've been using ZCX by default at AdaCore for several years now, so it's
 time to switch the default at the FSF as well I think, in particular since
 you are suggesting a patch that will make Makefile.in more complex (and
 hence harder to maintain) for no reason without this change.

 Arno


Ok, done.

Kai


Re: [patch ada]: Prevent warning about PERSONALITY_FUNCTION in raise-gcc.c

2011-03-28 Thread Kai Tietz
2011/3/28 Arnaud Charlet char...@adacore.com:
 Split submitted patch from thread [patch ada]: Fix issues about
 multilib build of native windows and handle MSG_WAITALL for windows
 native targets
 into separate ones.

 ChangeLog gcc/ada

 2011-03-28  Kai Tietz

       * raise-gcc.c (PERSONALITY_FUNCTION): Add prototype to
       prevent warning.

 OK, thanks for resubmitting separately.

Committed at revision 171594.

Thanks,
Kai


Re: [PATCH 1/4] Remove cgraph_node function and fixup all callers

2011-03-28 Thread Martin Jambor
Hi,

On Fri, Mar 25, 2011 at 05:55:24PM +0100, Jan Hubicka wrote:
Index: src/gcc/passes.c
===
--- src.orig/gcc/passes.c   2011-03-19 01:16:23.0 +0100
+++ src/gcc/passes.c2011-03-19 01:54:42.0 +0100
@@ -1344,7 +1344,7 @@ pass_init_dump_file (struct opt_pass *pa
   if (dump_file  current_function_decl)
{
  const char *dname, *aname;
- struct cgraph_node *node = cgraph_node 
(current_function_decl);
+ struct cgraph_node *node = cgraph_get_node 
(current_function_decl);
   
   Don't you want cgraph_do_get_node on those places that will ICE anyway?
  
  No, the other way round.  I only used cgraph_do_get_node when it would
  not ICE immediately but might later, like when the result was passed
  to a caller or stored in some data structure for later use.  However
  using it here is certainly possible, if you like.
 
 Hmm, OK.  The mutiplicity of cgraph accesstors is bit confusing.  For future
 development I would preffer if people don't really need to worry about those
 except for very corner cases (i.e. cgraph construction).
 
 I would like to have one most common way to get cgraph node that is
 used thorough backend.  I think it should be cgraph_do_get_node
 since in the backend all functions that matters should be in cgraph.

My intention is really to make cgraph_get_node the one main accessor
function almost everyone should use to get their node.  Of course,
that means the return value should be checked somehow.  My gut feeling
at this moment is that now there are still too many cases where it can
return NULL legitimately (builtins, OMP builtins, mudflap stuff,
profile generation stuff, size functions, calls from front-end for
aliases...) that whoever wants to get their node will have to
differentiate in between the two cases when they can assert the result
is not NULL and when they cannot.

That will change only if we manage to create a node for each of these
problematic corner cases before someone can ask for it and not remove
it when removing unreachable nodes if folder can still put it into IL
(etc. etc.).

In fact, cgraph_do_get_node was originally a hack to help me identify
places where cgraph_get_node returns NULL.  And them I realized it
might be useful so I left it in the patch.  Actually, I anticipated a
request to remove it completely, not make it the default :-)

On the other hand I do agree that the other accessors (create,
get_create) should be used very rarely - preferably only in
cgraph(re)build and front-ends and we should continue efforts to weed
them out of everywhere else.

  
Index: src/gcc/tree-ssa-alias.c
===
--- src.orig/gcc/tree-ssa-alias.c   2011-03-19 01:16:23.0 
+0100
+++ src/gcc/tree-ssa-alias.c2011-03-19 01:54:42.0 +0100
@@ -1246,14 +1246,15 @@ ref_maybe_used_by_call_p_1 (gimple call,
 
   /* Check if base is a global static variable that is not read
  by the function.  */
-  if (TREE_CODE (base) == VAR_DECL
+  if (callee != NULL_TREE
+   TREE_CODE (base) == VAR_DECL
   
   Why non-NULL tests are needed here?  It seems that at the time
   cgraph is created we should have nodes for all accessible functions.
  
  Almost.  We do not have a node for __builtin_GOMP_parallel_start when
  we examine a call from dse_possible_dead_store_p.  It would be nice in
  general if OMP made call graph nodes for its new functions in some
  more defined manner.  At this point it relies on cgraphbuild.c and
  apparently even that is sometimes not enough.  Should I add a FIXME
  here?
  
  The failing tests are gcc.dg/autopar/reduc-1.c and
  gcc.dg/autopar/reduc-2.c.
 
 
 Yes, please add FIXME.  It is better to fix incrementally, but I gor
 previously troubles with GOMP requiring or not requiring cgraph
 nodes to be present for interesting reasons (i.e. I have to disable
 unreachable node removal before GOMP is ready).  We need to clean
 this up.

OK

  
   
   What I wonder about is that we have similar API for annotations.  Here we 
   have
   var_ann_t for type name
   var_ann (var) for what cgraph_get_node is
   get_var_ann (var) for what cgraph_get_create_node is
   create_var_ann (var) for hwat cgraph_create_node is.
   
   So we may want to be consistent here. I never had problem with overlaping
   struct and function obvoiusly, but if people disagree, what about:
   
   cgraph_create_node = crate node and aborts if already exist
   cgraph_get_node = return node or create noe
   cgraph_maybe_get_node = return node or NULL
   cgraph_do_get_node = return node and abort if NULL.
   
   We may later even want to introduce our popular
   cgraph_node_d/cgraph_node_t and rename back cgraph_do_get_node
   to cgraph_node, since it is is the most common accestor.  I
   would preffer to do 

Re: [patch] Fix bogus source locations with optimization

2011-03-28 Thread Richard Guenther
On Mon, Mar 28, 2011 at 11:00 AM, Eric Botcazou ebotca...@adacore.com wrote:
 Hi,

 when optimization is enabled, especially -O2 and above, you can have lines in
 the assembly file with really bogus source location info.  The scenario is as
 follows: an optimization pass at the Tree level (typically PRE) creates a new
 statement and inserts it at some place in the dominator tree, creating a new
 basic block; this statement is (rightfully) given unknown location.  When
 RTL is being expanded, this statement inherits the current source location,
 which is the location of the last statement of the previous basic block.  Then
 basic block reordering kicks in and the statement is moved to another place,
 still carrying the inherited source location down to the assembly file.

 The proposed fix is to allow RTL statements to have unknown location (zero
 locator) like Tree statements.  They of course will be assigned the current
 source location but only in the assembly file, thus becoming sort of silent.

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

This overloads UNKNOWN_LOCATION for both insn_locator and
source_location, I don't think this is the best idea.  It'll eventually
break when compiling with C++ anyway.

The expand_gimple_stmt change will cause late diagnostic to
use an unknown location instead of one from a previously expanded
stmt.  Probably not ideal but matches what GIMPLE diagnostics
would have done earlier.

In general I think the patch is a good thing, but the UNKNOWN_LOCATION
overloading needs to be resolved.  Maybe just add UINKNOWN_LOCATOR?
The special value also should be documented somewhere (no idea where
core insn-locator functionality resides).

Thanks,
Richard.


 2011-03-28  Eric Botcazou  ebotca...@adacore.com

        * cfgexpand.c (expand_gimple_cond): Always set the source location and
        block before expanding the statement.
        (expand_gimple_stmt_1): Likewise.  Set them here...
        (expand_gimple_stmt): ...and not here.  Tidy.
        * cfglayout.c (curr_insn_locator): Return 0 if the current location is
        unknown.


 --
 Eric Botcazou



Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944)

2011-03-28 Thread Rainer Orth
Richard Guenther richard.guent...@gmail.com writes:

 I think if the plugin linker is different from the normal linker we should
 set HAVE_LTO_PLUGIN to 2.

 I think we should do the linker version checks which relate to linker-plugin
 use on the plugin-linker instead.  So if I specify a separate but known

I'll see if this is reasonably doable...

 buggy linker I don't want it to be used by default.

... but how about a different route for 4.7?  I've never really
understood the point of --with-plugin-ld.  Given that we have known-good
linkers, why not simply remove that wart?

Rainer

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


Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944)

2011-03-28 Thread Richard Guenther
On Mon, Mar 28, 2011 at 12:14 PM, Rainer Orth
r...@cebitec.uni-bielefeld.de wrote:
 Richard Guenther richard.guent...@gmail.com writes:

 I think if the plugin linker is different from the normal linker we should
 set HAVE_LTO_PLUGIN to 2.

 I think we should do the linker version checks which relate to linker-plugin
 use on the plugin-linker instead.  So if I specify a separate but known

 I'll see if this is reasonably doable...

 buggy linker I don't want it to be used by default.

 ... but how about a different route for 4.7?  I've never really
 understood the point of --with-plugin-ld.  Given that we have known-good
 linkers, why not simply remove that wart?

I sort-of agree, but for example for weird hosts like solaris we might want
to give people the option to not replace their system linker unless they
are using LTO.  We could of course direct them to --with-ld instead, replacing
the linker for a specific compiler only.

What I'd like to remove for 4.7 is the -fuse-linker-plugin
flag and non-linker-plugin operation (but that requires some more discussion).
At least we should warn people if no linker with appropriate plugin-support
was detected, as LTO support might be fragile then.

Richard.


Re: [patch ada]: Fix issues about multilib build of native windows

2011-03-28 Thread Arnaud Charlet
 Split submitted patch from thread [patch ada]: Fix issues about
 multilib build of native windows and handle MSG_WAITALL for windows
 native targets
 into separate ones.
 
 ChangeLog gcc/ada (ada_w_multi.txt)
 
 2011-03-28  Kai Tietz
 
   * gcc-interface/Makefile.in (SO_LIB): Handle multilib build for native
   windows targets.
   (EH_MECHANISM): Make sure we use gcc's exception mechanism for all
   native windows target.
   * system-mingw.ads (System): Change ZCX_By_Default default to
   True.

OK, thanks.


Re: fix for 48208 and 48260 on darwin

2011-03-28 Thread Joseph S. Myers
On Mon, 28 Mar 2011, Christian Schüler wrote:

   PR 48208
   * config/c.opt: Added 'Driver' to -F option

This part of the changes is OK with the ChangeLog entry fixed (it should 
go in c-family/ChangeLog):

PR driver/48208
* c.opt (-F): Add Driver.

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

Use LINK_PLUGIN_SPEC on Darwin (PR target/48245)

2011-03-28 Thread Rainer Orth
When developing the patch to use the linker plugin only if the (plugin)
linker supports it, I had neglected to check for targets that defined
their own version of LD_COMMAND_SPEC.  Of course, this couldn't go
unpunished, since there are two of them:

* Darwin has its own version in config/darwin.h.  This is updated by the
  following patch.

* The only other affected target is DJGPP (i[34567]86-pc-msdosdjgpp*),
  but config/i386/djgpp.has no provisions for LTO at all, so I'm not
  touching that.

The (almost obvious) patch was tested by Iain on *-darwin9 and by
Dominique on x86_64-darwin10.

Approved by Mike in the PR, installed on mainline.

Rainer


2011-03-26  Rainer Orth  r...@cebitec.uni-bielefeld.de
Iain Sandoe  ia...@gcc.gnu.org

PR target/48245
* config/darwin.h (LINK_COMMAND_SPEC_A): Use LINK_PLUGIN_SPEC.

diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -184,8 +184,9 @@ extern GTY(()) int darwin_ms_struct;
 
 #define LINK_COMMAND_SPEC_A \
%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
-%(linker) \
-%{flto*:%fcompare-debug*} \
+%(linker) \
+LINK_PLUGIN_SPEC \
+%{flto*:%fcompare-debug*} \
 %{flto*} \
 %l %X %{s} %{t} %{Z} %{u*} \
 %{e*} %{r} \

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


Re: [patch] Fix bogus source locations with optimization

2011-03-28 Thread Eric Botcazou
 This overloads UNKNOWN_LOCATION for both insn_locator and
 source_location, I don't think this is the best idea.  It'll eventually
 break when compiling with C++ anyway.

Could you elaborate?  UNKNOWN_LOCATION isn't used for INSN_LOCATOR at all 
thanks for the curr_insn_locator hunk.

 The expand_gimple_stmt change will cause late diagnostic to
 use an unknown location instead of one from a previously expanded
 stmt.  Probably not ideal but matches what GIMPLE diagnostics
 would have done earlier.

Huh?  What is the line setting input_location for?

 In general I think the patch is a good thing, but the UNKNOWN_LOCATION
 overloading needs to be resolved.  Maybe just add UINKNOWN_LOCATOR?
 The special value also should be documented somewhere (no idea where
 core insn-locator functionality resides).

Well, RTL locators are tested against zero all over the place so it's pretty 
clear what zero means.  I don't see any overloading here.

-- 
Eric Botcazou


Re: [patch] Fix bogus source locations with optimization

2011-03-28 Thread Richard Guenther
On Mon, Mar 28, 2011 at 1:08 PM, Eric Botcazou ebotca...@adacore.com wrote:
 This overloads UNKNOWN_LOCATION for both insn_locator and
 source_location, I don't think this is the best idea.  It'll eventually
 break when compiling with C++ anyway.

 Could you elaborate?  UNKNOWN_LOCATION isn't used for INSN_LOCATOR at all
 thanks for the curr_insn_locator hunk.

 int
 curr_insn_locator (void)
 {
-  if (curr_rtl_loc == -1)
+  if (curr_rtl_loc == -1 || curr_location == UNKNOWN_LOCATION)
 return 0;

Oh, I didn't realize curr_location is of type location_t.  I'm not very familiar
with these bits.  Btw, insn_locators_alloc initializes it with -1 while
it should probably initialize it with UNKNOWN_LCOATION as well.

 The expand_gimple_stmt change will cause late diagnostic to
 use an unknown location instead of one from a previously expanded
 stmt.  Probably not ideal but matches what GIMPLE diagnostics
 would have done earlier.

 Huh?  What is the line setting input_location for?

Oh, it's contionally set ... not enough coffee.

 In general I think the patch is a good thing, but the UNKNOWN_LOCATION
 overloading needs to be resolved.  Maybe just add UINKNOWN_LOCATOR?
 The special value also should be documented somewhere (no idea where
 core insn-locator functionality resides).

 Well, RTL locators are tested against zero all over the place so it's pretty
 clear what zero means.  I don't see any overloading here.

So it looks like the patch is perfect after all.  And ok.

Thanks,
Richard.

 --
 Eric Botcazou



Re: [patch ada]: Fix MSG_WAITALL handling for windows native targets

2011-03-28 Thread Kai Tietz
2011/3/28 Arnaud Charlet char...@adacore.com:
 Kai,

 Here are Thomas comments on your patch:

 --
 Split submitted patch from thread [patch ada]: Fix issues about
 multilib build of native windows and handle MSG_WAITALL for windows
 native targets
 into separate ones.

 ChangeLog gcc/ada (ada_wt.txt)

 2011-03-28  Kai Tietz

       * g-socthi-mingw.adb (C_Recvmsg): Handle MSG_WAITALL for
       windows native targets.
       * s-oscons-tmplt.c (MSG_WAITALL): Define it for native windows
       targets to flag value.

        Fill  : constant Boolean :=
 -                (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
 +                SOSC.MSG_WAITALL /= -1
 +                and then (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
        --  Is the MSG_WAITALL flag set? If so we need to fully fill all 
 vectors

 Not sure about this. The other change (to s-oscons-tmplt.c) causes
 SOSC.MSG_WAITALL to always be defined to 8 in the Windows case, so the
 new test against -1 (which would have been relevant without the other
 change) now becomes redundant.

Well, I can remove it from patch. But IMHO it would be good to fix
here logic, even if it has obviously no effect here anymore.  As often
such code simply gets copy  pasted and then a latent bug can be
copied.

  #ifndef MSG_WAITALL
 +#ifdef __MINWGW32__
 +/* We use it on windows native targets, so set to flag value.  */
 +# define MSG_WAITALL (1  3)
 +#else

 The comment is completely meaningless and should be rewritten. In
 particular a note should be added to explain why this will work even
 though MSG_WAITALL is not defined in the Winsock header files.

Yes, I wrote some more details about this definition.  It is related
to the use of winsock/winsock2. The define MSG_WAITALL is just defined
for wsock API 2. Nevertheless we link internally against wsock2-API
(ws2_32), and so it is available anyway.

Updated patch attached.

Regards,
Kai
Index: gcc/gcc/ada/g-socthi-mingw.adb
===
--- gcc.orig/gcc/ada/g-socthi-mingw.adb 2011-03-28 11:40:51.941851800 +0200
+++ gcc/gcc/ada/g-socthi-mingw.adb  2011-03-28 13:09:04.309293900 +0200
@@ -277,7 +277,8 @@ package body GNAT.Sockets.Thin is
   use type C.size_t;
 
   Fill  : constant Boolean :=
-(C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
+SOSC.MSG_WAITALL /= -1
+and then (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0;
   --  Is the MSG_WAITALL flag set? If so we need to fully fill all vectors
 
   Res   : C.int;
Index: gcc/gcc/ada/s-oscons-tmplt.c
===
--- gcc.orig/gcc/ada/s-oscons-tmplt.c   2011-03-28 11:40:51.949851800 +0200
+++ gcc/gcc/ada/s-oscons-tmplt.c2011-03-28 13:13:51.479759900 +0200
@@ -1084,6 +1084,11 @@ CND(MSG_PEEK, Peek at incoming data)
 CND(MSG_EOR, Send end of record)
 
 #ifndef MSG_WAITALL
+#ifdef __MINWGW32__
+/* The value of MSG_WAITALL is 8.  Nevertheless winsock.h doesn't
+   define it, but it is still usable as we link to winsock2 API.  */
+# define MSG_WAITALL (1  3)
+#else
 # define MSG_WAITALL -1
 #endif
 CND(MSG_WAITALL, Wait for full reception)


Re: Use LINK_PLUGIN_SPEC on Darwin (PR target/48245)

2011-03-28 Thread Dominique Dhumieres
Rainer,

Ignore my previous comment: I just saw the quotes on the other changed
lines.

Thanks for the commit.

Dominique


PATCH: PR testsuite/48276: FAIL: gcc.target/i386/pr47502-2.c

2011-03-28 Thread H.J. Lu
Hi,

gcc.target/i386/pr47502-2.c uses EBX which doesn't work with PIC.
I am checking in this patch as an obvious fix.

H.J.
---
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a9f70d0..53424d2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-28  H.J. Lu  hongjiu...@intel.com
+
+   PR testsuite/48276
+   * gcc.target/i386/pr47502-2.c: Add -fno-pic.
+
 2011-03-28  Eric Botcazou  ebotca...@adacore.com
 
* gcc.dg/slp-1.c: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr47502-2.c 
b/gcc/testsuite/gcc.target/i386/pr47502-2.c
index 1f57ea0..a8dc1ca 100644
--- a/gcc/testsuite/gcc.target/i386/pr47502-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr47502-2.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options -O2 } */
+/* { dg-options -O2 -fno-pic } */
 
 int
 foo (int how, const void *set, void *oset)


[patch] plug mem leak in gcse

2011-03-28 Thread Steven Bosscher
Hi,

The bitmap reg_set_bitmap is allocated in alloc_gcse_mem, but it is
never freed. The foul smell of a mem leak...

Plugged thus. Bootstrappedtested on x86_64-unknown-linux-gnu. OK for trunk?

Ciao!
Steven


* gcse.c (free_gcse_mem): Free reg_set_bitmap.

Index: gcse.c
===
--- gcse.c  (revision 171599)
+++ gcse.c  (working copy)
@@ -657,6 +657,8 @@
 static void
 free_gcse_mem (void)
 {
+  FREE_REG_SET (reg_set_bitmap);
+
   free_modify_mem_tables ();
   BITMAP_FREE (modify_mem_list_set);
   BITMAP_FREE (blocks_with_calls);


Re: [patch] plug mem leak in gcse

2011-03-28 Thread Richard Guenther
On Mon, Mar 28, 2011 at 3:29 PM, Steven Bosscher stevenb@gmail.com wrote:
 Hi,

 The bitmap reg_set_bitmap is allocated in alloc_gcse_mem, but it is
 never freed. The foul smell of a mem leak...

 Plugged thus. Bootstrappedtested on x86_64-unknown-linux-gnu. OK for trunk?

Ok.

Thanks,
Richard.

 Ciao!
 Steven


 * gcse.c (free_gcse_mem): Free reg_set_bitmap.

 Index: gcse.c
 ===
 --- gcse.c      (revision 171599)
 +++ gcse.c      (working copy)
 @@ -657,6 +657,8 @@
  static void
  free_gcse_mem (void)
  {
 +  FREE_REG_SET (reg_set_bitmap);
 +
   free_modify_mem_tables ();
   BITMAP_FREE (modify_mem_list_set);
   BITMAP_FREE (blocks_with_calls);



PATCH: PR boehm-gc/48299: FAIL: boehm-gc.c/thread_leak_test.c

2011-03-28 Thread H.J. Lu
Hi,

GC_LINUX_THREADS is redefined.  This patch fixes it.  OK for trunk?
Thanks.

H.J.

diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index f6b1865..557167c 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-28  H.J. Lu  hongjiu...@intel.com
+
+   PR boehm-gc/48299
+   * testsuite/boehm-gc.c/thread_leak_test.c: Don't define
+   GC_LINUX_THREADS.
+
 2011-03-25  Rainer Orth  r...@cebitec.uni-bielefeld.de
 
PR boehm-gc/11412
diff --git a/boehm-gc/testsuite/boehm-gc.c/thread_leak_test.c 
b/boehm-gc/testsuite/boehm-gc.c/thread_leak_test.c
index eb4cb9b..ba5bea9 100644
--- a/boehm-gc/testsuite/boehm-gc.c/thread_leak_test.c
+++ b/boehm-gc/testsuite/boehm-gc.c/thread_leak_test.c
@@ -1,4 +1,3 @@
-#define GC_LINUX_THREADS
 #include leak_detector.h
 #include pthread.h
 #include stdio.h


Add support for DragonFlyBSD target to top level configure

2011-03-28 Thread Nick Clifton
Hi Guys,

  I am propagating the attached patch from the binutils source tree.  It
  adds support for the DragonFlyBSD target to the top level configure
  script.

Cheers
  Nick

./ChangeLog
2011-03-26  John Marino  binut...@marino.st

* configure.ac: Add support for *-*-dragonfly*
* configure: Regenerate.

Index: configure.ac
===
--- configure.ac(revision 171591)
+++ configure.ac(working copy)
@@ -349,7 +349,8 @@
 case ${target} in
   *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
   | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
-  | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+  | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
+  | *-*-solaris2* | *-*-nto*)
 case ${target} in
   *-*-linux*aout* | *-*-linux*oldld*)
 ;;
@@ -509,7 +510,7 @@
 case ${target} in
 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
;;
-*-*-netbsd* | *-*-freebsd* | *-*-openbsd*)
+*-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
;;
 *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11*)
;;
@@ -545,6 +546,9 @@
 noconfigdirs=$noconfigdirs sim target-rda
 noconfigdirs=$noconfigdirs ${libgcj}
 ;;
+  *-*-dragonfly*)
+noconfigdirs=$noconfigdirs target-newlib target-libgloss
+;;
   *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
 noconfigdirs=$noconfigdirs target-newlib target-libgloss ${libgcj}
 ;;


Re: [PATCH] Better .debug_aranges fix (PR debug/48253, take 3)

2011-03-28 Thread Jason Merrill

On 03/25/2011 01:01 PM, Jakub Jelinek wrote:

+   if (node == loc_list-last_before_switch
+(node != loc_list-first || loc_list-first-next)
+current_function_decl)


Let's store this test in a local variable rather than repeat it a few 
lines down.



+  if (fde-dw_fde_second_begin  fde-dw_fde_switch_cfi == NULL)
+start_label = fde-dw_fde_second_begin;


Can this happen?  If we haven't switched, second_begin should be null.

Otherwise, looks good.

Jason


Re: [H8300] Remove ASM_OUTPUT_BSS

2011-03-28 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/27/11 14:32, Anatoly Sokolov wrote:
 Hi.
 
   In config/h8300/h8300.h file both ASM_OUTPUT_BSS and ASM_OUTPUT_ALIGNED_BSS 
 macros is defined, but the ASM_OUTPUT_BSS macro is not used when 
 ASM_OUTPUT_ALIGNED_BSS is defined. This patch remove ASM_OUTPUT_BSS macro 
 from H8300 target. 
 
   Regression tested on h8300-unknown-elf with no new failure.
 
   OK to install? 
 
 * config/h8300/h8300.h (ASM_OUTPUT_BSS): Remove macro.

OK.  Please install.

Thanks,
jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNkJu+AAoJEBRtltQi2kC7h5wIALuAx8X1VFeEHYzrlwBJA1nO
GXK8DCcs6vRQvkvoNLXH2juQSis8DeSbFBc+LH8ut3f/cepB7RZs4SKS9RgkdfzZ
UZhZdB2qLKUCfq6UNqRgmvmGFYUqI+tlv+GH9lJzzX3M6KmxW/XgPiqg8xHUSWo0
8HGoP3W9dsY6+Fpxjx0nf3dIykp4SMIWj1O9FUkkUF+nVxcB63AuIhCIyIY9z+O8
ihgiJFnVnugoMkpxH+K9fLxz+HnAKG2ltVP7Hb7h3QxfKuDv5hGR77uu8BpA//sI
2tQdPhOD3u9kb2CVDN7fcc3wScpcjN7xl3/YL9gSI0iLJawhYryD7HMFwD1H5CA=
=4nDS
-END PGP SIGNATURE-


Re: [h8300] Hookize FUNCTION_VALUE, LIBCALL_VALUE and FUNCTION_VALUE_REGNO_P

2011-03-28 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/27/11 14:07, Anatoly Sokolov wrote:
 Hello.
 
   This patch removes obsolete FUNCTION_VALUE, LIBCALL_VALUE and
 FUNCTION_VALUE_REGNO_P macros from H8300 back end in the GCC and introduces
 equivalent TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE and
 TARGET_FUNCTION_VALUE_REGNO_P target hooks.
 
   Regression tested on h8300-unknown-elf with no new failure.
 
   OK to install? 
 
 * config/h8300/h8300.h (FUNCTION_VALUE_REGNO_P, FUNCTION_VALUE,
 LIBCALL_VALUE): Remove macros.
 * config/h8300/h8300.c (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE,
 TARGET_FUNCTION_VALUE_REGNO_P): Define.
 (h8300_function_value, h8300_libcall_value,
 h8300_function_value_regno_p): New functions
Ok.  Please install.

Thanks,
jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNkJxMAAoJEBRtltQi2kC7e5oH/jgU4PJeayoxR1tHTy/BVHpP
ZLW8RRw41eMKkDJ/+CBbahogosTBCYFiT13C1HM7g8h/zXICN8HT56YK1IDU8ZW3
hmaXYpTmecv31nBcoI/lFwtEhP0+bYzr/jbOL65dkklU+gGSS/PbqY82ejFgppfW
6U4K1sBE/dS322VMNLgYG6rKlnsz1EaX4MmV9m65zQf1U6r42HmC5Or7qsGlUYva
y2T2ZgvelXGWkKh1uhxJ0SJcdG1nozFHbPCk+0XmYoZlHFuXHvLFplSJ6KncRdCT
WvExwOVVEXpgqhZqhV6dnoGzopx6RAym8eh01n5bWhPHhQ+sB26UyWSs/QabYvw=
=ZBQi
-END PGP SIGNATURE-


Re: [PATCH] Better .debug_aranges fix (PR debug/48253, take 3)

2011-03-28 Thread Jakub Jelinek
On Mon, Mar 28, 2011 at 10:23:08AM -0400, Jason Merrill wrote:
 On 03/25/2011 01:01 PM, Jakub Jelinek wrote:
 +if (node == loc_list-last_before_switch
 + (node != loc_list-first || loc_list-first-next)
 + current_function_decl)
 
 Let's store this test in a local variable rather than repeat it a
 few lines down.

Ok, will do.

 +  if (fde-dw_fde_second_begin  fde-dw_fde_switch_cfi == NULL)
 +start_label = fde-dw_fde_second_begin;
 
 Can this happen?  If we haven't switched, second_begin should be null.

It could happen if the first partition didn't contain any CFI adjustments,
but the second one did.  As dw_fde_switch_cfi points to the last CFI
before the switch, it will be NULL in that case.  But now that I think about
it, in that case we should still add something for the fde-dw_fde_begin ..
fde-dw_fde_end range.

So perhaps
  if (fde-dw_fde_second_begin  fde-dw_fde_switch_cfi == NULL)
{
  /* If the first partition contained no CFI adjustments, the
 CIE opcodes apply to the whole first partition.  */
  *list_tail = new_loc_list (build_cfa_loc (last_cfa, offset),
 fde-dw_fde_begin, fde-dw_fde_end, section);
  list_tail = (*list_tail)-dw_loc_next;
  start_label = last_label = fde-dw_fde_second_begin;
}
instead and put this right before the for cycle (so that last_cfa
is already computed).

Jakub


Re: [PATCH] Better .debug_aranges fix (PR debug/48253, take 3)

2011-03-28 Thread Jason Merrill

On 03/28/2011 10:34 AM, Jakub Jelinek wrote:

So perhaps
   if (fde-dw_fde_second_begin  fde-dw_fde_switch_cfi == NULL)
 {
   /* If the first partition contained no CFI adjustments, the
 CIE opcodes apply to the whole first partition.  */
   *list_tail = new_loc_list (build_cfa_loc (last_cfa, offset),
 fde-dw_fde_begin, fde-dw_fde_end, section);
   list_tail =(*list_tail)-dw_loc_next;
   start_label = last_label = fde-dw_fde_second_begin;
 }
instead and put this right before the for cycle (so that last_cfa
is already computed).


Sounds good.

Jason


Re: C++ PATCH for c++/48289 (-pedantic breaks std::move)

2011-03-28 Thread Jason Merrill

On 03/27/2011 08:17 PM, Eric Botcazou wrote:

Tested x86_64-pc-linux-gnu, applied to trunk and 4.5, will apply to 4.6
after 4.6.0.


The test doesn't pass on the 4.5 branch:
   FAIL: g++.dg/cpp0x/move1.C (test for excess errors)


Good point.  I guess I won't bother trying to fix this in 4.5.  Reverted.

Jason


[committed/vms] fix ice for vms/ia64

2011-03-28 Thread Tristan Gingold
Hi,

gcc crashes during cross-build of libiberty due to a bad handling of 
promote_function_mode.
This patch fixes that.

Committed on trunk.

Tristan.

2011-03-28  Tristan Gingold  ging...@adacore.com

* config/ia64/ia64.c (ia64_promote_function_mode): Fix promotion
when for_return is 2.

Index: gcc/config/ia64/ia64.c
===
--- gcc/config/ia64/ia64.c  (revision 171607)
+++ gcc/config/ia64/ia64.c  (working copy)
@@ -11001,7 +11001,7 @@
  For all other types passed in the general registers, unused bits are
  undefined.  */
 
-  if (!AGGREGATE_TYPE_P (type)
+  if (for_return != 2
GET_MODE_CLASS (mode) == MODE_INT
GET_MODE_SIZE (mode)  UNITS_PER_WORD)
 {



Use gen_int_mode in expand_builtin_memset_args

2011-03-28 Thread Richard Sandiford
This patch fixes a case where expand_builtin_memset_args was creating
a zero- rather than sign-extended character-sized CONST_INT.  The problem
showed up on s390, where a character was being passed as (const_int 171)
rather than (const_int -85).

Tested on x86_64-linux-gnu.  Andreas also confirms that it fixes
the s390 failure.  OK to install?

Richard


gcc/
* builtins.c (expand_builtin_memset_args): Use gen_int_mode
instead of GEN_INT.

Index: gcc/builtins.c
===
--- gcc/builtins.c  2011-03-24 15:13:39.0 +
+++ gcc/builtins.c  2011-03-28 13:56:31.0 +0100
@@ -3935,6 +3935,7 @@ expand_builtin_memset_args (tree dest, t
 {
   tree fndecl, fn;
   enum built_in_function fcode;
+  enum machine_mode val_mode;
   char c;
   unsigned int dest_align;
   rtx dest_mem, dest_addr, len_rtx;
@@ -3969,14 +3970,14 @@ expand_builtin_memset_args (tree dest, t
 
   len_rtx = expand_normal (len);
   dest_mem = get_memory_rtx (dest, len);
+  val_mode = TYPE_MODE (unsigned_char_type_node);
 
   if (TREE_CODE (val) != INTEGER_CST)
 {
   rtx val_rtx;
 
   val_rtx = expand_normal (val);
-  val_rtx = convert_to_mode (TYPE_MODE (unsigned_char_type_node),
-val_rtx, 0);
+  val_rtx = convert_to_mode (val_mode, val_rtx, 0);
 
   /* Assume that we can memset by pieces if we can store
* the coefficients by pieces (in the required modes).
@@ -3987,8 +3988,7 @@ expand_builtin_memset_args (tree dest, t
  builtin_memset_read_str, c, dest_align,
  true))
{
- val_rtx = force_reg (TYPE_MODE (unsigned_char_type_node),
-  val_rtx);
+ val_rtx = force_reg (val_mode, val_rtx);
  store_by_pieces (dest_mem, tree_low_cst (len, 1),
   builtin_memset_gen_str, val_rtx, dest_align,
   true, 0);
@@ -4014,7 +4014,8 @@ expand_builtin_memset_args (tree dest, t
  true))
store_by_pieces (dest_mem, tree_low_cst (len, 1),
 builtin_memset_read_str, c, dest_align, true, 0);
-  else if (!set_storage_via_setmem (dest_mem, len_rtx, GEN_INT (c),
+  else if (!set_storage_via_setmem (dest_mem, len_rtx,
+   gen_int_mode (c, val_mode),
dest_align, expected_align,
expected_size))
goto do_libcall;


C++ PATCH to fix constexpr/noexcept bug

2011-03-28 Thread Jason Merrill
We need to call cxx_constant_value after converting to bool, in case the 
conversion uses a conversion operator.


Tested x86_64-pc-linux-gnu, applying to trunk and 4.6.
commit a3fde3e7dcdc6b4f0b92bb273f4267c6bf8f6de0
Author: Jason Merrill ja...@redhat.com
Date:   Sun Mar 27 21:51:35 2011 -0400

* except.c (build_noexcept_spec): Call cxx_constant_value after
converting to bool.

diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index c05e507..a814d67 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1203,10 +1203,10 @@ build_noexcept_spec (tree expr, int complain)
  it until instantiation.  */
   if (!processing_template_decl)
 {
-  expr = cxx_constant_value (expr);
   expr = perform_implicit_conversion_flags (boolean_type_node, expr,
complain,
LOOKUP_NORMAL);
+  expr = cxx_constant_value (expr);
 }
   if (expr == boolean_true_node)
 return noexcept_true_spec;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C 
b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C
new file mode 100644
index 000..7bf961b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C
@@ -0,0 +1,15 @@
+// { dg-options -std=c++0x }
+
+struct booleable {
+  bool data;
+  constexpr explicit operator bool() { return data; }
+};
+
+constexpr booleable truthy_func() { return {true}; }
+
+void funky() noexcept(truthy_func()) {}
+
+int main() {
+  funky();
+  return 0;
+}


Re: Use gen_int_mode in expand_builtin_memset_args

2011-03-28 Thread Richard Guenther
On Mon, Mar 28, 2011 at 5:47 PM, Richard Sandiford
richard.sandif...@linaro.org wrote:
 This patch fixes a case where expand_builtin_memset_args was creating
 a zero- rather than sign-extended character-sized CONST_INT.  The problem
 showed up on s390, where a character was being passed as (const_int 171)
 rather than (const_int -85).

 Tested on x86_64-linux-gnu.  Andreas also confirms that it fixes
 the s390 failure.  OK to install?

Ok.

Thanks,
Richard.

 Richard


 gcc/
        * builtins.c (expand_builtin_memset_args): Use gen_int_mode
        instead of GEN_INT.

 Index: gcc/builtins.c
 ===
 --- gcc/builtins.c      2011-03-24 15:13:39.0 +
 +++ gcc/builtins.c      2011-03-28 13:56:31.0 +0100
 @@ -3935,6 +3935,7 @@ expand_builtin_memset_args (tree dest, t
  {
   tree fndecl, fn;
   enum built_in_function fcode;
 +  enum machine_mode val_mode;
   char c;
   unsigned int dest_align;
   rtx dest_mem, dest_addr, len_rtx;
 @@ -3969,14 +3970,14 @@ expand_builtin_memset_args (tree dest, t

   len_rtx = expand_normal (len);
   dest_mem = get_memory_rtx (dest, len);
 +  val_mode = TYPE_MODE (unsigned_char_type_node);

   if (TREE_CODE (val) != INTEGER_CST)
     {
       rtx val_rtx;

       val_rtx = expand_normal (val);
 -      val_rtx = convert_to_mode (TYPE_MODE (unsigned_char_type_node),
 -                                val_rtx, 0);
 +      val_rtx = convert_to_mode (val_mode, val_rtx, 0);

       /* Assume that we can memset by pieces if we can store
        * the coefficients by pieces (in the required modes).
 @@ -3987,8 +3988,7 @@ expand_builtin_memset_args (tree dest, t
                                  builtin_memset_read_str, c, dest_align,
                                  true))
        {
 -         val_rtx = force_reg (TYPE_MODE (unsigned_char_type_node),
 -                              val_rtx);
 +         val_rtx = force_reg (val_mode, val_rtx);
          store_by_pieces (dest_mem, tree_low_cst (len, 1),
                           builtin_memset_gen_str, val_rtx, dest_align,
                           true, 0);
 @@ -4014,7 +4014,8 @@ expand_builtin_memset_args (tree dest, t
                                  true))
        store_by_pieces (dest_mem, tree_low_cst (len, 1),
                         builtin_memset_read_str, c, dest_align, true, 0);
 -      else if (!set_storage_via_setmem (dest_mem, len_rtx, GEN_INT (c),
 +      else if (!set_storage_via_setmem (dest_mem, len_rtx,
 +                                       gen_int_mode (c, val_mode),
                                        dest_align, expected_align,
                                        expected_size))
        goto do_libcall;



C++ PATCHes to fix ref binding to array temporaries

2011-03-28 Thread Jason Merrill
In discussion of core issue 1232 we realized that we already do allow 
array temporaries in some cases (primarily as subobjects of class 
temporaries), so we ought to handle them consistently.


The first patch fixes direct binding to array prvalues, which has been 
specified for a while.


The second patch specifies the semantics of a conversion from 
initializer-list to array for binding the temporary to a reference.


Tested x86_64-pc-linux-gnu, applying to trunk and 4.6.
commit 43d838d444e21ec34ed9d72e2e64315129d02291
Author: Jason Merrill ja...@redhat.com
Date:   Thu Mar 24 14:48:44 2011 +0100

* call.c (reference_binding): Allow direct binding to an array
rvalue.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 93383c6..9a9ac76 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1429,7 +1429,9 @@ reference_binding (tree rto, tree rfrom, tree expr, bool 
c_cast_p, int flags)
  || (((CP_TYPE_CONST_NON_VOLATILE_P (to)
 !(flags  LOOKUP_NO_TEMP_BIND))
   || TYPE_REF_IS_RVALUE (rto))
-  (CLASS_TYPE_P (from) || (expr  lvalue_p (expr))
+  (CLASS_TYPE_P (from)
+ || TREE_CODE (from) == ARRAY_TYPE
+ || (expr  lvalue_p (expr))
 {
   /* [dcl.init.ref]
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C 
b/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C
new file mode 100644
index 000..25113d7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C
@@ -0,0 +1,5 @@
+// { dg-options -std=c++0x }
+
+typedef int IRT[2];
+
+const IRT ir = IRT{1,2};
commit e84d467f48170f6b8fda35b38569cdab4104427f
Author: Jason Merrill ja...@redhat.com
Date:   Thu Mar 24 15:36:12 2011 +0100

Core 1232
* call.c (build_array_conv): New.
(implicit_conversion): Use it.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 9a9ac76..a1cfa96 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -801,6 +801,53 @@ build_aggr_conv (tree type, tree ctor, int flags)
   return c;
 }
 
+/* Represent a conversion from CTOR, a braced-init-list, to TYPE, an
+   array type, if such a conversion is possible.  */
+
+static conversion *
+build_array_conv (tree type, tree ctor, int flags)
+{
+  conversion *c;
+  unsigned HOST_WIDE_INT len = CONSTRUCTOR_NELTS (ctor);
+  tree elttype = TREE_TYPE (type);
+  unsigned i;
+  tree val;
+  bool bad = false;
+  bool user = false;
+  enum conversion_rank rank = cr_exact;
+
+  if (TYPE_DOMAIN (type))
+{
+  unsigned HOST_WIDE_INT alen = tree_low_cst (array_type_nelts_top (type), 
1);
+  if (alen  len)
+   return NULL;
+}
+
+  FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val)
+{
+  conversion *sub
+   = implicit_conversion (elttype, TREE_TYPE (val), val,
+  false, flags);
+  if (sub == NULL)
+   return NULL;
+
+  if (sub-rank  rank)
+   rank = sub-rank;
+  if (sub-user_conv_p)
+   user = true;
+  if (sub-bad_p)
+   bad = true;
+}
+
+  c = alloc_conversion (ck_aggr);
+  c-type = type;
+  c-rank = rank;
+  c-user_conv_p = user;
+  c-bad_p = bad;
+  c-u.next = NULL;
+  return c;
+}
+
 /* Build a representation of the identity conversion from EXPR to
itself.  The TYPE should match the type of EXPR, if EXPR is non-NULL.  */
 
@@ -1623,6 +1670,8 @@ implicit_conversion (tree to, tree from, tree expr, bool 
c_cast_p,
  return conv;
}
}
+  else if (TREE_CODE (to) == ARRAY_TYPE)
+   return build_array_conv (to, expr, flags);
 }
 
   if (expr != NULL_TREE
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C 
b/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C
new file mode 100644
index 000..19eec33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C
@@ -0,0 +1,12 @@
+// { dg-options -std=c++0x }
+
+typedef int IA[2];
+typedef double DA[2];
+
+void f(const IA) { }
+void f(const DA);
+
+int main()
+{
+  f({1,2});
+}


[testsuite] Generalize REs in gcc.dg/debug/dwarf2/pr47939-[1-4].c (PR testsuite/48238)

2011-03-28 Thread Rainer Orth
As described in the PR, four new DWARF-2 tests FAIL on Solaris 2 with
Sun as, IRIX 6.5 with gas, and Darwin.  Dominique provided the following
patch.

Tested with the appropriate runtest invocations on i386-pc-solaris2.11
with Sun as and gas and mips-sgi-irix6.5 by myself, and
x86_64-apple-darwin10.6.0 by Dominique.

Installed on mainline.

Rainer


2011-03-26  Dominique d'Humieres  domi...@lps.ens.fr

PR testsuite/48238
* gcc.dg/debug/dwarf2/pr47939-1.c: Generalize scan-assembler regex.
* gcc.dg/debug/dwarf2/pr47939-2.c: Likewise.
* gcc.dg/debug/dwarf2/pr47939-3.c: Likewise.
* gcc.dg/debug/dwarf2/pr47939-4.c: Likewise.

diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c 
b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-1.c
@@ -4,5 +4,5 @@
 typedef struct _Harry { int dummy; } Harry_t;
 Harry_t harry;
 
-/* { dg-final { scan-assembler 
DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_name: \Harry_t\ } } 
*/
+/* { dg-final { scan-assembler 
DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*(DW_AT_name: 
\Harry_t\|\Harry_t..\\[^\\r\\n\]*DW_AT_name) } } */
 /* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c 
b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-2.c
@@ -4,5 +4,5 @@
 typedef const struct _Harry { int dummy; } Harry_t;
 Harry_t harry;
 
-/* { dg-final { scan-assembler 
DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_name: \Harry_t\ } } 
*/
+/* { dg-final { scan-assembler 
DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*(DW_AT_name: 
\Harry_t\|\Harry_t..\\[^\\r\\n\]*DW_AT_name) } } */
 /* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c 
b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-3.c
@@ -4,5 +4,5 @@
 typedef struct _Harry { int dummy; } Harry_t;
 const Harry_t harry[5];
 
-/* { dg-final { scan-assembler 
DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_name: \Harry_t\ } } 
*/
+/* { dg-final { scan-assembler 
DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*(DW_AT_name: 
\Harry_t\|\Harry_t..\\[^\\r\\n\]*DW_AT_name) } } */
 /* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c 
b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr47939-4.c
@@ -4,5 +4,5 @@
 typedef const struct _Harry { int dummy; } Harry_t;
 Harry_t harry[10];
 
-/* { dg-final { scan-assembler 
DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_name: \Harry_t\ } } 
*/
+/* { dg-final { scan-assembler 
DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*(DW_AT_name: 
\Harry_t\|\Harry_t..\\[^\\r\\n\]*DW_AT_name) } } */
 /* { dg-final { cleanup-saved-temps } } */

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


Re: [PATCH] ENTRY_VALUE fixes (PR debug/48203)

2011-03-28 Thread Richard Henderson
On 03/20/2011 05:57 AM, Jakub Jelinek wrote:
   * cfgexpand.c (expand_debug_expr) case SSA_NAME: Only
   create ENTRY_VALUE if incoming or address of incoming's MEM
   is a hard REG.
   * dwarf2out.c (mem_loc_descriptor): Don't emit
   DW_OP_GNU_entry_value of DW_OP_fbreg.

Ok.

   * var-tracking.c (vt_add_function_parameter): Ensure cselib_lookup
   on ENTRY_VALUE is able to find the canonical parameter VALUE.

I don't really understand what's going on here.  Whatever it is, it
could definitely use some more commentary; there's almost nothing in
the surrounding context.  I also suggest pulling some of this out into
a new function.  You've got 2 exact copies here in the patch, and 2
more that are nearly the same already in the code.

   * cselib.c (rtx_equal_for_cselib_1) case ENTRY_VALUE: Use
   rtx_equal_p instead of rtx_equal_for_cselib_1 to compare
   ENTRY_VALUE_EXPs.

Ok.

   (cselib_hash_rtx) case ENTRY_VALUE: If ENTRY_VALUE_EXP
   is a REG_P or MEM_P with REG_P address, compute hash directly
   instead of calling cselib_hash_rtx on ENTRY_VALUE_EXP.

Why?

   (preserve_only_constants): Don't clear VALUES forwaring
   ENTRY_VALUE to some other VALUE.

Ok with a comment.  I guess the reasoning being that even though this
value isn't constant, it's function invariant?


r~


[PING][PATCH, testsuite] Update gcc.dg/stack-usage-1.c SIZE values for powerpc

2011-03-28 Thread Peter Bergner
I'd like to ping this test suite patch:

[PATCH, testsuite] Update gcc.dg/stack-usage-1.c SIZE values for powerpc

http://gcc.gnu.org/ml/gcc-patches/2011-02/msg00077.html

Peter





Re: [PING][PATCH, testsuite] Update gcc.dg/stack-usage-1.c SIZE values for powerpc

2011-03-28 Thread Mike Stump
On Mar 28, 2011, at 10:12 AM, Peter Bergner wrote:
 I'd like to ping this test suite patch:
 
 [PATCH, testsuite] Update gcc.dg/stack-usage-1.c SIZE values for powerpc
 
http://gcc.gnu.org/ml/gcc-patches/2011-02/msg00077.html

Normally, I'd prefer the target folks to approve these sorts, but since they 
haven't in 2 months...

Ok.

Watch for any fall out...  I'm hoping it all works ok as is on darwin, or at 
least doesn't regress it.  For darwin bits, you can see the results at 
http://gcc.gnu.org/regtest/HEAD/ about 8-12 hours after you check it in.


Re: [PATCH] ENTRY_VALUE fixes (PR debug/48203)

2011-03-28 Thread Jakub Jelinek
On Mon, Mar 28, 2011 at 09:58:38AM -0700, Richard Henderson wrote:
  * var-tracking.c (vt_add_function_parameter): Ensure cselib_lookup
  on ENTRY_VALUE is able to find the canonical parameter VALUE.
 
 I don't really understand what's going on here.  Whatever it is, it
 could definitely use some more commentary; there's almost nothing in
 the surrounding context.  I also suggest pulling some of this out into
 a new function.  You've got 2 exact copies here in the patch, and 2
 more that are nearly the same already in the code.

As cfgexpand.c creates ENTRY_VALUEs (where the first hunk of this patch
applies), when vt_initialization uses cselib to lookup those ENTRY_VALUEs,
without the patch it will find a newly created cselib_val whose
only location is the ENTRY_VALUE.  Which means it will always use
DW_OP_GNU_entry_value in the end.  Sometimes that is the only usable choice,
but e.g. the first function in gcc.dg/pr48203.c shows we can do better,
because all the entry values are also held in the corresponding registers
(the function doesn't clobber them), so we can instead of
DW_OP_GNU_entry_value just refer to the registers itself, either in the
whole function, or at least as long as the aren't clobbered by something
else.  The extra cselib_lookup calls give us those values that hash
as those ENTRY_VALUE will hash and by telling that the value is live
in the parameter's VALUE vt_expand_loc_callback will find it.

Say vt_add_function_parameter is called for first parameter in %rdi,
cselib_lookup_from_insn gives us VALUE 2:2 for it.  We add
(entry_value:DI (reg:DI %rdi)) to list of locations for that VALUE.
The second cselib_lookup_from_insn gives us VALUE 3:217, which will
have locations (value:DI 2:2) (the one we've injected there) and
(entry_value:DI (reg:DI %rdi)).  Then when (entry_value:DI (reg:DI %rdi))
appears in some DEBUG_INSNs, it will give (value:DI 3:217)
and vt_expand_loc_callback will use the first location for it
(i.e. (value:DI 2:2) ) and either it will see the value is still live
in %rdi, some other register or memory, or, if nowhere else, in
(entry_value:DI (reg:DI %rdi)).  The 3 cselib.c changes from this
patch ensure that the hash value for (entry_value:DI (reg:DI %rdi))
will always be the same and (value:DI 3:217) will never be flushed from
the hash table, even when e.g. on next bb's boundary we flush
all registers from the hash table, or e.g. when movl $123, %edi
is seen in the insns.

I could of course create another hash table and map ENTRY_VALUEs through
that hash table back to the parameter VALUEs, but cselib already has
a hash table which we can use and furthermore the ENTRY_VALUEs could
be embedded in other RTLs.

I will look into creating helper inlines to reduce code duplication.

  * cselib.c (rtx_equal_for_cselib_1) case ENTRY_VALUE: Use
  rtx_equal_p instead of rtx_equal_for_cselib_1 to compare
  ENTRY_VALUE_EXPs.
 
 Ok.
 
  (cselib_hash_rtx) case ENTRY_VALUE: If ENTRY_VALUE_EXP
  is a REG_P or MEM_P with REG_P address, compute hash directly
  instead of calling cselib_hash_rtx on ENTRY_VALUE_EXP.
 
 Why?

Because REG and MEM hash based on their current value in cselib:
case MEM:
case REG:
  e = cselib_lookup (x, GET_MODE (x), create, memmode);
  if (! e)
return 0;

  return e-hash;
In ENTRY_VALUEs which are function invariant I want it to hash always
the same.

  (preserve_only_constants): Don't clear VALUES forwaring
  ENTRY_VALUE to some other VALUE.
 
 Ok with a comment.  I guess the reasoning being that even though this
 value isn't constant, it's function invariant?

Yeah.  Perhaps preserve_only_constants could be renamed
to preserve_only_function_invariants or similar (and likewise for
cselib_preserve_constants and CSELIB_PRESERVE_CONSTANTS).

Jakub


Re: [PATCH] ENTRY_VALUE fixes (PR debug/48203)

2011-03-28 Thread Richard Henderson
On 03/28/2011 10:32 AM, Jakub Jelinek wrote:
 Say vt_add_function_parameter is called for first parameter in %rdi,
 cselib_lookup_from_insn gives us VALUE 2:2 for it.  We add
 (entry_value:DI (reg:DI %rdi)) to list of locations for that VALUE.
 The second cselib_lookup_from_insn gives us VALUE 3:217, which will
 have locations (value:DI 2:2) (the one we've injected there) and
 (entry_value:DI (reg:DI %rdi)).  Then when (entry_value:DI (reg:DI %rdi))
 appears in some DEBUG_INSNs, it will give (value:DI 3:217)
 and vt_expand_loc_callback will use the first location for it
 (i.e. (value:DI 2:2) ) and either it will see the value is still live
 in %rdi, some other register or memory, or, if nowhere else, in
 (entry_value:DI (reg:DI %rdi)).  The 3 cselib.c changes from this
 patch ensure that the hash value for (entry_value:DI (reg:DI %rdi))
 will always be the same and (value:DI 3:217) will never be flushed from
 the hash table, even when e.g. on next bb's boundary we flush
 all registers from the hash table, or e.g. when movl $123, %edi
 is seen in the insns.

Ok, thanks for the explanation.  All the changes make sense now.

 I will look into creating helper inlines to reduce code duplication.

Please.  You can do this as a follow-up if you prefer.

 (cselib_hash_rtx) case ENTRY_VALUE: If ENTRY_VALUE_EXP
 is a REG_P or MEM_P with REG_P address, compute hash directly
 instead of calling cselib_hash_rtx on ENTRY_VALUE_EXP.

 Why?
 
 Because REG and MEM hash based on their current value in cselib:
 case MEM:
 case REG:
   e = cselib_lookup (x, GET_MODE (x), create, memmode);
   if (! e)
 return 0;
 
   return e-hash;
 In ENTRY_VALUEs which are function invariant I want it to hash always
 the same.

Ok, with something akin to this as a comment.


r~


Re: fix for 48208 and 48260 on darwin

2011-03-28 Thread Mike Stump
On Mar 27, 2011, at 8:55 PM, Christian Schüler wrote:
 please review the following patch (and besides, bear with me as this is the 
 first patch proposal from me). For gcc 4.5 and earlier it was possible to 
 configure xcode via a modified xcplugin to use the newer gcc directly (yes, 
 the -arch flag was ignored during link time, but since I had -m32/-m64 
 anyways, this didn't matter). With the new argument checking of version 4.6 
 during the linking stage this is no longer possible. The proposed patch makes 
 gcc on darwin recognize the -arch flag to the extent necessary to reinstate 
 the old functionality. Besides, it fixes the already existing support for the
 -F flag.

Ok (when regression tested).  Did you run the gcc regression testsuite on it?  
To install it, we'd need a testsuite run on it.  Roughy, run the testsuite 
before your patch, save off the .sum file, run it after your patch, then run 
contrib/compare_tests before.sum after.sum and see if there is any output.  You 
might need expect/tcl/dejagnu installed to do that.



If you want to contribute longer term (larger patches), you'll want to get 
started on your paper work, if you've not done that already.  And, welcome.  
Before you say, but...  let me say, what took so long, 10 years is a long 
while?  :-)


Re: [google] Allow relative profile paths. (issue4280074)

2011-03-28 Thread dnovillo

OK.  A nit and a question below.


Diego.


http://codereview.appspot.com/4280074/diff/1/gcc/doc/invoke.texi
File gcc/doc/invoke.texi (right):

http://codereview.appspot.com/4280074/diff/1/gcc/doc/invoke.texi#newcode
gcc/doc/invoke.texi:: and its related options. Both absolute and
relative can be used.
s/relative/relative paths/

http://codereview.appspot.com/4280074/diff/1/gcc/libgcov.c
File gcc/libgcov.c (right):

http://codereview.appspot.com/4280074/diff/1/gcc/libgcov.c#newcode286
gcc/libgcov.c:286: if (prefix_length != 0  !IS_DIR_SEPARATOR (*fname))
I'm confused.  why did you take !HAS_DRIVE_SPEC() out?

http://codereview.appspot.com/4280074/


libgo patch committed: Rename fd_rtems.go to fd_select.go

2011-03-28 Thread Ian Lance Taylor
I renamed fd_rtems.go to fd_select.go in libgo, since the file is used
for operating systems other than RTEMS.  Bootstrapped on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 381b9fce29e2 libgo/Makefile.am
--- a/libgo/Makefile.am	Mon Mar 28 11:07:46 2011 -0700
+++ b/libgo/Makefile.am	Mon Mar 28 11:26:53 2011 -0700
@@ -642,7 +642,7 @@
 	go/mime/type.go
 
 if LIBGO_IS_RTEMS
-go_net_fd_os_file = go/net/fd_rtems.go
+go_net_fd_os_file = go/net/fd_select.go
 go_net_newpollserver_file = go/net/newpollserver_rtems.go
 else # !LIBGO_IS_RTEMS
 if LIBGO_IS_LINUX
@@ -651,7 +651,7 @@
 else # !LIBGO_IS_LINUX  !LIBGO_IS_RTEMS
 # By default use select with pipes.  Most systems should have
 # something better.
-go_net_fd_os_file = go/net/fd_rtems.go
+go_net_fd_os_file = go/net/fd_select.go
 go_net_newpollserver_file = go/net/newpollserver.go
 endif # !LIBGO_IS_LINUX
 endif # !LIBGO_IS_RTEMS
diff -r 381b9fce29e2 libgo/go/net/fd_rtems.go
--- a/libgo/go/net/fd_rtems.go	Mon Mar 28 11:07:46 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +
@@ -1,137 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Waiting for FDs via select(2).
-
-package net
-
-import (
-	os
-	syscall
-)
-
-type pollster struct {
-	readFds, writeFds, repeatFds *syscall.FdSet_t
-	maxFd int
-	readyReadFds, readyWriteFds *syscall.FdSet_t
-	nReady int
-	lastFd int
-}
-
-func newpollster() (p *pollster, err os.Error) {
-	p = new(pollster)
-	p.readFds = new(syscall.FdSet_t)
-	p.writeFds = new(syscall.FdSet_t)
-	p.repeatFds = new(syscall.FdSet_t)
-	p.readyReadFds = new(syscall.FdSet_t)
-	p.readyWriteFds = new(syscall.FdSet_t)
-	p.maxFd = -1
-	p.nReady = 0
-	p.lastFd = 0
-	return p, nil
-}
-
-func (p *pollster) AddFD(fd int, mode int, repeat bool) os.Error {
-	if mode == 'r' {
-		syscall.FDSet(fd, p.readFds)
-	} else {
-		syscall.FDSet(fd, p.writeFds)
-	}
-
-	if repeat {
-		syscall.FDSet(fd, p.repeatFds)
-	}
-
-	if fd  p.maxFd {
-		p.maxFd = fd
-	}
-
-	return nil
-}
-
-func (p *pollster) DelFD(fd int, mode int) {
-	if mode == 'r' {
-		if !syscall.FDIsSet(fd, p.readFds) {
-			print(Select unexpected fd=, fd,  for read\n)
-			return
-		}
-		syscall.FDClr(fd, p.readFds)
-	} else {
-		if !syscall.FDIsSet(fd, p.writeFds) {
-			print(Select unexpected fd=, fd,  for write\n)
-			return
-		}
-		syscall.FDClr(fd, p.writeFds)
-	}
-
-	// Doesn't matter if not already present.
-	syscall.FDClr(fd, p.repeatFds)
-
-	// We don't worry about maxFd here.
-}
-
-func (p *pollster) WaitFD(nsec int64) (fd int, mode int, err os.Error) {
-	if p.nReady == 0 {
-		var timeout *syscall.Timeval
-		var tv syscall.Timeval
-		timeout = nil
-		if nsec  0 {
-			tv = syscall.NsecToTimeval(nsec)
-			timeout = tv
-		}
-
-		var n, e int
-		var tmpReadFds, tmpWriteFds syscall.FdSet_t
-		for {
-			// Temporary syscall.FdSet_ts into which the values are copied
-			// because select mutates the values.
-			tmpReadFds = *p.readFds
-			tmpWriteFds = *p.writeFds
-
-			n, e = syscall.Select(p.maxFd + 1, tmpReadFds, tmpWriteFds, nil, timeout)
-			if e != syscall.EINTR {
-break
-			}
-		}
-		if e != 0 {
-			return -1, 0, os.NewSyscallError(select, e)
-		}
-		if n == 0 {
-			return -1, 0, nil
-		}
-
-		p.nReady = n
-		*p.readyReadFds = tmpReadFds
-		*p.readyWriteFds = tmpWriteFds
-		p.lastFd = 0
-	}
-
-	flag := false
-	for i := p.lastFd; i  p.maxFd + 1; i++ {
-		if syscall.FDIsSet(i, p.readyReadFds) {
-			flag = true
-			mode = 'r'
-			syscall.FDClr(i, p.readyReadFds)
-		} else if syscall.FDIsSet(i, p.readyWriteFds) {
-			flag = true
-			mode = 'w'
-			syscall.FDClr(i, p.readyWriteFds)
-		}
-		if flag {
-			if !syscall.FDIsSet(i, p.repeatFds) {
-p.DelFD(i, mode)
-			}
-			p.nReady--
-			p.lastFd = i
-			return i, mode, nil
-		}
-	}
-
-	// Will not reach here.  Just to shut up the compiler.
-	return -1, 0, nil
-}
-
-func (p *pollster) Close() os.Error {
-	return nil
-}
diff -r 381b9fce29e2 libgo/go/net/fd_select.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +
+++ b/libgo/go/net/fd_select.go	Mon Mar 28 11:26:53 2011 -0700
@@ -0,0 +1,137 @@
+// Copyright 2010 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Waiting for FDs via select(2).
+
+package net
+
+import (
+	os
+	syscall
+)
+
+type pollster struct {
+	readFds, writeFds, repeatFds *syscall.FdSet_t
+	maxFd int
+	readyReadFds, readyWriteFds *syscall.FdSet_t
+	nReady int
+	lastFd int
+}
+
+func newpollster() (p *pollster, err os.Error) {
+	p = new(pollster)
+	p.readFds = new(syscall.FdSet_t)
+	p.writeFds = new(syscall.FdSet_t)
+	p.repeatFds = new(syscall.FdSet_t)
+	p.readyReadFds = new(syscall.FdSet_t)
+	p.readyWriteFds = new(syscall.FdSet_t)
+	p.maxFd = -1
+	p.nReady = 0
+	p.lastFd = 0
+	return p, nil
+}
+
+func (p *pollster) AddFD(fd int, mode int, repeat bool) os.Error {
+	if mode == 'r' {
+		

Re: Improve jump threading #1 of N

2011-03-28 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/26/11 11:43, Richard Guenther wrote:
 
 Looks good to me apart from not using gsi_start_nondebug_bb in
 thread_around_empty_block.
Ah.  I wasn't aware of gsi_start_nondebug_bb.  I updated the patch to
use it, ran another bootstrap and regression test.

Attached is the final patch that's being installed onto the trunk.


Thanks,
Jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNkNSJAAoJEBRtltQi2kC73DcIALH8k+/SXMcZy7tYcVrTs6Bq
YR5kyIIMIMjf2G+pEas0WVEP99XoJLbxUHITQFNZtdnhvl62BV23BiVyWVS0KRqB
oUdxdcQhV8x1F6JKKt9oHQ1eVd1ktNTrVGYnWnx24f97x8VYpaKG4fLAsPW221Sy
qBgm4iaY5/nnI8w7fuoruPSUXvMGQVN2g24HcQ/nQ3FPJvmeyZswRajWjylj9Zgg
wZXvmrG4GeOpOIZTD2KwlA1e3f8S1kzIKabOdz/Wgz3jfybI1tE/msSd6m4ID9FE
2m+lQ+AwT40xqcet0M3AB667JVw87Q01Gm+hAmK8qrgIZrhjpMZuHE2wCC6hDjg=
=KKSc
-END PGP SIGNATURE-
* tree-ssa-threadupdate.c (redirect_edges): Call
create_edge_and_update_destination_phis as needed.
(create_edge_and_update_destination_phis): Accept new BB argument.
All callers updated.
(thread_block): Do not update the profile when threading around
intermediate blocks.
(thread_single_edge): Likewise.
(determine_bb_domination_status): If BB is not a successor of the
loop header, return NONDOMINATING.
(register_jump_thread): Note when we register a jump thread around
an intermediate block.
* tree-ssa-threadedge.c (thread_around_empty_block): New function.
(thread_across_edge): Use it.

* gcc.dg/tree-ssa/ssa-dom-thread-3.c: New test.

Index: tree-ssa-threadupdate.c
===
*** tree-ssa-threadupdate.c (revision 171620)
--- tree-ssa-threadupdate.c (working copy)
*** lookup_redirection_data (edge e, edge in
*** 304,317 
 destination.  */
  
  static void
! create_edge_and_update_destination_phis (struct redirection_data *rd)
  {
!   edge e = make_edge (rd-dup_block, rd-outgoing_edge-dest, EDGE_FALLTHRU);
gimple_stmt_iterator gsi;
  
rescan_loop_exit (e, true, false);
e-probability = REG_BR_PROB_BASE;
!   e-count = rd-dup_block-count;
e-aux = rd-outgoing_edge-aux;
  
/* If there are any PHI nodes at the destination of the outgoing edge
--- 304,318 
 destination.  */
  
  static void
! create_edge_and_update_destination_phis (struct redirection_data *rd,
!basic_block bb)
  {
!   edge e = make_edge (bb, rd-outgoing_edge-dest, EDGE_FALLTHRU);
gimple_stmt_iterator gsi;
  
rescan_loop_exit (e, true, false);
e-probability = REG_BR_PROB_BASE;
!   e-count = bb-count;
e-aux = rd-outgoing_edge-aux;
  
/* If there are any PHI nodes at the destination of the outgoing edge
*** create_duplicates (void **slot, void *da
*** 359,365 
  
/* Go ahead and wire up outgoing edges and update PHIs for the duplicate
   block.  */
!   create_edge_and_update_destination_phis (rd);
  }
  
/* Keep walking the hash table.  */
--- 360,366 
  
/* Go ahead and wire up outgoing edges and update PHIs for the duplicate
   block.  */
!   create_edge_and_update_destination_phis (rd, rd-dup_block);
  }
  
/* Keep walking the hash table.  */
*** fixup_template_block (void **slot, void 
*** 380,386 
   and halt the hash table traversal.  */
if (rd-dup_block  rd-dup_block == local_info-template_block)
  {
!   create_edge_and_update_destination_phis (rd);
return 0;
  }
  
--- 381,387 
   and halt the hash table traversal.  */
if (rd-dup_block  rd-dup_block == local_info-template_block)
  {
!   create_edge_and_update_destination_phis (rd, rd-dup_block);
return 0;
  }
  
*** redirect_edges (void **slot, void *data)
*** 443,448 
--- 444,454 
  remove_ctrl_stmt_and_useless_edges (local_info-bb,
  rd-outgoing_edge-dest);
  
+ /* If we are threading beyond the immediate successors of
+the duplicate, then BB will have no edges, create one.  */
+ if (EDGE_COUNT (local_info-bb-succs) == 0)
+   create_edge_and_update_destination_phis (rd, local_info-bb);
+ 
  /* Fixup the flags on the single remaining edge.  */
  single_succ_edge (local_info-bb)-flags
= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE | EDGE_ABNORMAL);
*** thread_block (basic_block bb, bool noloo
*** 565,572 
  continue;
}
  
!   update_bb_profile_for_threading (e-dest, EDGE_FREQUENCY (e),
!  e-count, (edge) e-aux);
  
/* Insert the outgoing edge into the hash table if it is not
 already in the hash table.  */
--- 571,579 
  

libgo patch committed: Fix fd_select.go

2011-03-28 Thread Ian Lance Taylor
This patch fixes fd_select.go for the changes in FD handling in the
latest libgo update.  The code in libgo now takes advantage of the fact
that if you change the set of descriptors used by epoll, it is not
necessary to wake up the thread waiting in epoll_wait.  That is not true
of select: if you change the set of descriptors, you do have to wake up
the select.  This patch implements that.  Bootstrapped on
x86_64-unknown-linux-gnu.  Ran Go testsuite using fd_select.go instead
of fd_linux.go.  Committed to mainline.  This fixes PR go/48312.

Ian

diff -r 056f7c9c13f8 libgo/go/net/fd.go
--- a/libgo/go/net/fd.go	Mon Mar 28 11:28:45 2011 -0700
+++ b/libgo/go/net/fd.go	Mon Mar 28 11:30:46 2011 -0700
@@ -122,9 +122,13 @@
 		doWakeup = true
 	}
 
-	if err := s.poll.AddFD(intfd, mode, false); err != nil {
+	wake, err := s.poll.AddFD(intfd, mode, false)
+	if err != nil {
 		panic(pollServer AddFD  + err.String())
 	}
+	if wake {
+		doWakeup = true
+	}
 
 	s.Unlock()
 
diff -r 056f7c9c13f8 libgo/go/net/fd_linux.go
--- a/libgo/go/net/fd_linux.go	Mon Mar 28 11:28:45 2011 -0700
+++ b/libgo/go/net/fd_linux.go	Mon Mar 28 11:30:46 2011 -0700
@@ -47,7 +47,7 @@
 	return p, nil
 }
 
-func (p *pollster) AddFD(fd int, mode int, repeat bool) os.Error {
+func (p *pollster) AddFD(fd int, mode int, repeat bool) (bool, os.Error) {
 	// pollServer is locked.
 
 	var already bool
@@ -69,10 +69,10 @@
 		op = syscall.EPOLL_CTL_ADD
 	}
 	if e := syscall.EpollCtl(p.epfd, op, fd, p.ctlEvent); e != 0 {
-		return os.NewSyscallError(epoll_ctl, e)
+		return false, os.NewSyscallError(epoll_ctl, e)
 	}
 	p.events[fd] = p.ctlEvent.Events
-	return nil
+	return false, nil
 }
 
 func (p *pollster) StopWaiting(fd int, bits uint) {
diff -r 056f7c9c13f8 libgo/go/net/fd_select.go
--- a/libgo/go/net/fd_select.go	Mon Mar 28 11:28:45 2011 -0700
+++ b/libgo/go/net/fd_select.go	Mon Mar 28 11:30:46 2011 -0700
@@ -32,7 +32,9 @@
 	return p, nil
 }
 
-func (p *pollster) AddFD(fd int, mode int, repeat bool) os.Error {
+func (p *pollster) AddFD(fd int, mode int, repeat bool) (bool, os.Error) {
+	// pollServer is locked.
+
 	if mode == 'r' {
 		syscall.FDSet(fd, p.readFds)
 	} else {
@@ -47,10 +49,12 @@
 		p.maxFd = fd
 	}
 
-	return nil
+	return true, nil
 }
 
 func (p *pollster) DelFD(fd int, mode int) {
+	// pollServer is locked.
+
 	if mode == 'r' {
 		if !syscall.FDIsSet(fd, p.readFds) {
 			print(Select unexpected fd=, fd,  for read\n)
@@ -71,7 +75,7 @@
 	// We don't worry about maxFd here.
 }
 
-func (p *pollster) WaitFD(nsec int64) (fd int, mode int, err os.Error) {
+func (p *pollster) WaitFD(s *pollServer, nsec int64) (fd int, mode int, err os.Error) {
 	if p.nReady == 0 {
 		var timeout *syscall.Timeval
 		var tv syscall.Timeval
@@ -89,7 +93,10 @@
 			tmpReadFds = *p.readFds
 			tmpWriteFds = *p.writeFds
 
+			s.Unlock()
 			n, e = syscall.Select(p.maxFd + 1, tmpReadFds, tmpWriteFds, nil, timeout)
+			s.Lock()
+
 			if e != syscall.EINTR {
 break
 			}
diff -r 056f7c9c13f8 libgo/go/net/newpollserver.go
--- a/libgo/go/net/newpollserver.go	Mon Mar 28 11:28:45 2011 -0700
+++ b/libgo/go/net/newpollserver.go	Mon Mar 28 11:30:46 2011 -0700
@@ -31,7 +31,7 @@
 	if s.poll, err = newpollster(); err != nil {
 		goto Error
 	}
-	if err = s.poll.AddFD(s.pr.Fd(), 'r', true); err != nil {
+	if _, err = s.poll.AddFD(s.pr.Fd(), 'r', true); err != nil {
 		s.poll.Close()
 		goto Error
 	}
diff -r 056f7c9c13f8 libgo/go/net/newpollserver_rtems.go
--- a/libgo/go/net/newpollserver_rtems.go	Mon Mar 28 11:28:45 2011 -0700
+++ b/libgo/go/net/newpollserver_rtems.go	Mon Mar 28 11:30:46 2011 -0700
@@ -68,7 +68,7 @@
 	if s.poll, err = newpollster(); err != nil {
 		goto Error
 	}
-	if err = s.poll.AddFD(s.pr.Fd(), 'r', true); err != nil {
+	if _, err = s.poll.AddFD(s.pr.Fd(), 'r', true); err != nil {
 		s.poll.Close()
 		goto Error
 	}


Re: [patch] Split RTL constant/copy propagation off from gcse.c to new cprop.c

2011-03-28 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/28/11 10:25, Steven Bosscher wrote:
 Hello,
 
 This patch splits the CPROP pass (constant/copy propagation for RTL)
 out of gcse.c into a new file cprop.c. Originally all the
 Muchnick-passes (GCSE, PRE, CPROP, HOIST, store motion, ...) lived
 in gcse.c and a lot of code was shared, but these days much of that
 shared code is just common infrastructure (DF and a CFG, for instance)
 and the amount of shared code between the passes is much less than it
 used to be. I already moved out store motion a few years ago, and this
 patch continues my split-up-gcse efforts.
 
 With this patch, I end up with about 450 lines of shared code between
 gcse.c and the new cprop.c, but that number will go down to almost
 nothing once I'm done with cprop.c.
 
 The main reason for me to spilt CPROP out of gcse.c is because a lot
 of the shared code really shouldn't be shared anymore. For instance,
 the internal dataflow engine of GCSE handles registers and memory, but
 this is completely unnecessary for CPROP because it only looks at
 registers. So there is a lot of overhead for CPROP memory tracking
 that just consumes time and isn't actually used by the pass.
 
 My plan is to change the dataflow stuff in cprop.c to be DF-based,
 including the use of the DF solver which should be much faster and
 scales better than the lcm.c/gcse.c solvers. This is the first step.
 
 During the split, I cleaned up the table-set_p stuff and a few other
 really minor things like comments, but there are no functional changes
 for now. The asm output before and after this patch is the same.
 
 Bootstrapped and tested on x86_64-unknown-linux-gnu. OK?
OK.
jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNkNUWAAoJEBRtltQi2kC7/50H/j//zFNU9180/i2EZOeQLb1E
wq0raoDiGuO8fl58JnSmEhHpTB03UztsGeRM3wYOLo95908lPNgGWGBYbM/a4ZPh
90e1FiNz7Y9vot6rqG9AI4+Iuw6LlglM2vAB+MNQ9UpcqwdaSCoxG/c6Ycjo9kpN
KqqJYiqYc2i6gpBWoIWZI2oBCmPaM2eJEwpZ2yQuzm/BvdltHZouR1z6q2DmERbl
NtKUFM37998cZLcTpEk0aw7bb0XtAWMRALz+4kiYu6HpBMsSn5sTzhIqtuz4mPXH
dyapzqbp/oL+pMg0GpzlMKeli0vgdYZaSyTwMtLbz9sly+kSAv0qp9NUWKWjGro=
=YNVz
-END PGP SIGNATURE-


Re: [google] Allow relative profile paths. (issue4280074)

2011-03-28 Thread Diego Novillo
On Mon, Mar 28, 2011 at 14:14,  mart...@google.com wrote:

 On 2011/03/28 17:59:32, Diego Novillo wrote:

 I'm confused.  why did you take !HAS_DRIVE_SPEC() out?

 Earlier in the function, the following code makes sure we don't start
 the fname with a DRIVE_SPEC.

      if (prefix_length != 0  HAS_DRIVE_SPEC(fname))
        fname += 2;

Ah, quite right.  Thanks.


Diego.


Re: [patch, fortran] Extend character optimization to LLE and friends

2011-03-28 Thread Richard Henderson
On 03/28/2011 11:50 AM, Thomas Koenig wrote:
 +case GFC_ISYM_LLE:
 +  return optimize_comparison (e, INTRINSIC_LE);
 +  break;

Style nit: remove the unreachable break statements.


r~


Re: PATCH: Split AVX 32byte unalignd load/store

2011-03-28 Thread Richard Henderson
On 03/27/2011 11:57 AM, H.J. Lu wrote:
 +{ -mavx256-split-unaligned-stroe,  
 MASK_AVX256_SPLIT_UNALIGNED_STORE},

Typo.


r~


[pph] Tidy naming scheme for some functions (issue4291074)

2011-03-28 Thread Diego Novillo

No functional changes.  Rename some functions to make them consistent
with the other functions in the file.

cp/ChangeLog.pph.

2011-03-28  Diego Novillo  dnovi...@google.com

* pph.c (pph_write_format): Rename from write_pph_format.
(pph_write_namespace): Rename from write_pph_namespace.
(pph_write_print): Rename from write_pph_print.
(pph_write_dump): Rename from write_pph_dump.
(pph_write_symbol): Rename from write_pph_symbol.
(pph_write_namespace): Rename from write_pph_namespace.
(pph_write_namespace_1): Rename from write_pph_namespace_1.
(pph_write_file_object): Rename from write_pph_file_object.
(pph_write_file_summary): Rename from write_pph_file_summary.
(pph_write_file_dump): Rename from write_pph_file_dump.
(pph_write_file): Rename from write_pph_file.
(pph_file_read_object): Rename from read_pph_file_object.
(pph_file_read): Rename from read_pph_file.

diff --git a/gcc/cp/pph.c b/gcc/cp/pph.c
index 5ec7916..8c46665 100644
--- a/gcc/cp/pph.c
+++ b/gcc/cp/pph.c
@@ -1843,17 +1843,17 @@ pth_file_change (cpp_reader *reader, const struct 
line_map *map)
 
 /* Write PPH output file.  */
 
-typedef void (*write_pph_format)(pph_stream *stream, tree decl, int flags);
+typedef void (*pph_write_format)(pph_stream *stream, tree decl, int flags);
 
 /* Forward declarations to break cyclic references.  */
 static void
-write_pph_namespace (pph_stream *, tree, write_pph_format, int);
+pph_write_namespace (pph_stream *, tree, pph_write_format, int);
 
 
 /* Write symbol to PPH output file like C.  */
 
 static void
-write_pph_print (pph_stream *stream, tree decl, int flags ATTRIBUTE_UNUSED)
+pph_write_print (pph_stream *stream, tree decl, int flags ATTRIBUTE_UNUSED)
 {
   pph_output_tree (stream, decl);
 }
@@ -1862,7 +1862,7 @@ write_pph_print (pph_stream *stream, tree decl, int flags 
ATTRIBUTE_UNUSED)
 /* Write symbol to PPH output file as a dump.  */
 
 static void
-write_pph_dump (pph_stream *stream, tree decl, int flags)
+pph_write_dump (pph_stream *stream, tree decl, int flags)
 {
   dump_node (decl, flags, stream-file);
 }
@@ -1871,11 +1871,11 @@ write_pph_dump (pph_stream *stream, tree decl, int 
flags)
 /* Write symbol to PPH output file.  */
 
 static void
-write_pph_symbol (pph_stream *stream, tree decl, write_pph_format fmt,
+pph_write_symbol (pph_stream *stream, tree decl, pph_write_format fmt,
  int flags)
 {
   if (TREE_CODE (decl) == NAMESPACE_DECL)
-write_pph_namespace (stream, decl, fmt, flags);
+pph_write_namespace (stream, decl, fmt, flags);
   else if (!DECL_IS_BUILTIN (decl))
 fmt (stream, decl, flags);
 }
@@ -1883,51 +1883,51 @@ write_pph_symbol (pph_stream *stream, tree decl, 
write_pph_format fmt,
 
 /* Write namespace to PPH output file.  */
 
-typedef void (*declvisitor)(pph_stream *, tree, write_pph_format, int);
+typedef void (*declvisitor)(pph_stream *, tree, pph_write_format, int);
 
 static void
-write_pph_namespace_1 (declvisitor vtor, pph_stream *stream, tree decl,
-   write_pph_format fmt, int flags)
+pph_write_namespace_1 (declvisitor vtor, pph_stream *stream, tree decl,
+   pph_write_format fmt, int flags)
 {
   tree prior = TREE_CHAIN (decl);
   if (prior)
-write_pph_namespace_1 (vtor, stream, prior, fmt, flags);
+pph_write_namespace_1 (vtor, stream, prior, fmt, flags);
   vtor (stream, decl, fmt, flags);
 }
 
 static void
-write_pph_namespace (pph_stream *stream, tree decl, write_pph_format fmt,
+pph_write_namespace (pph_stream *stream, tree decl, pph_write_format fmt,
 int flags)
 {
   struct cp_binding_level *level = NAMESPACE_LEVEL (decl);
   decl = level-namespaces;
   if (decl)
-write_pph_namespace_1 (write_pph_namespace, stream, decl, fmt, flags);
+pph_write_namespace_1 (pph_write_namespace, stream, decl, fmt, flags);
   decl = level-names;
   if (decl)
-write_pph_namespace_1 (write_pph_symbol, stream, decl, fmt, flags);
+pph_write_namespace_1 (pph_write_symbol, stream, decl, fmt, flags);
 }
 
 
 /* Write PPH output symbols and IDENTS_USED to STREAM as an object.  */
 
 static void
-write_pph_file_object (pph_stream *stream, cpp_idents_used *idents_used)
+pph_write_file_object (pph_stream *stream, cpp_idents_used *idents_used)
 { 
   int flags = 0;
   pth_save_identifiers (idents_used, stream);
-  write_pph_namespace (stream, global_namespace, write_pph_print, flags);
+  pph_write_namespace (stream, global_namespace, pph_write_print, flags);
 }
 
 
 /* Write PPH output symbols and IDENTS_USED to STREAM as a pretty summary.  */
 
 static void
-write_pph_file_summary (pph_stream *stream, cpp_idents_used *idents_used)
+pph_write_file_summary (pph_stream *stream, cpp_idents_used *idents_used)
 { 
   int flags = 0;
   pph_print_macro_defs_before (stream, idents_used);
-  write_pph_namespace (stream, global_namespace, write_pph_print, flags);
+  

Go patch committed: Don't check for dup interface/named method

2011-03-28 Thread Ian Lance Taylor
A named interface type may not have methods.  Therefore, there is no
reason to check whether the same name is used for an interface method
and a regular method.  This patch removes this useless test.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

diff -r 932221f27f0b go/types.cc
--- a/go/types.cc	Mon Mar 28 11:32:23 2011 -0700
+++ b/go/types.cc	Mon Mar 28 14:12:12 2011 -0700
@@ -7029,9 +7029,8 @@
   if (this-local_methods_ != NULL)
 {
   Struct_type* st = this-type_-struct_type();
-  Interface_type* it = this-type_-interface_type();
   bool found_dup = false;
-  if (st != NULL || it != NULL)
+  if (st != NULL)
 	{
 	  for (Bindings::const_declarations_iterator p =
 		 this-local_methods_-begin_declarations();
@@ -7046,13 +7045,6 @@
 			   Gogo::message_name(name).c_str());
 		  found_dup = true;
 		}
-	  if (it != NULL  it-find_method(name) != NULL)
-		{
-		  error_at(p-second-location(),
-			   method %qs redeclares interface method name,
-			   Gogo::message_name(name).c_str());
-		  found_dup = true;
-		}
 	}
 	}
   if (found_dup)


Re: [PING][PATCH, testsuite] Update gcc.dg/stack-usage-1.c SIZE values for powerpc

2011-03-28 Thread Peter Bergner
On Mon, 2011-03-28 at 20:48 +0200, Dominique Dhumieres wrote:
 The test gcc.dg/stack-usage-1.c already failed on powerpc-apple-darwin9
 before you change with:
 
 FAIL: gcc.dg/stack-usage-1.c scan-file foo\t(256|264)\tstatic
 
 and is still failing the same way after it.
 
 [karma] f90/bug% grep foo stack-usage-1.su
 stack-usage-1.c:54:5:foo  272 static
 
 for -m32 and
 
 [karma] f90/bug% grep foo stack-usage-1.su
 stack-usage-1.c:54:5:foo  288 static
 
 for -m64.

Just guessing at the numbers, does the following patch fix the
failures for you?  I did not add a non-Altivec 32-bit define,
since I believe Altivec is always enabled for darwin, correct?

Peter


Index: gcc/testsuite/gcc.dg/stack-usage-1.c
===
--- gcc/testsuite/gcc.dg/stack-usage-1.c(revision 171620)
+++ gcc/testsuite/gcc.dg/stack-usage-1.c(working copy)
@@ -31,11 +31,19 @@
 #define SIZE 248
 #  endif
 #elif defined (__powerpc64__) || defined (__PPC64__)
-#  define SIZE 180
+#  if defined (__APPLE__)
+#define SIZE 148
+#  else
+#define SIZE 180
+#  endif
 #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
   || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
 #  if defined (__ALTIVEC__)
-#define SIZE 220
+#if defined (__APPLE__)
+#  define SIZE 204
+#else
+#  define SIZE 220
+#endif
 #  else
 #define SIZE 240
 #  endif




Interlacing switch labels and compound statements

2011-03-28 Thread Bruce Korb


I stumbled over this code using a source code analyzer.
It incorrectly assumed that switch labels cannot be inserted
into random places inside of enclosed compound statements.
It correctly assumes that you shouldn't be doing that. :)
I propose making this change solely for aesthetics:

static void
pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
{
  switch (TREE_CODE (t))
{
case FUNCTION_DECL:
  /* Constructors don't have return types.  And conversion functions
 do not have a type-specifier in their return types.  */
  if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t))
pp_cxx_function_specifier (pp, t);
  else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t)));
  else
default:
  pp_c_declaration_specifiers (pp_c_base (pp), t);
  break;
}
}

This is, indeed, legal, but just because it is legal doesn't make it clear.
Even if it were reasonable, wouldn't it be written thus?

static void
pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
{
  switch (TREE_CODE (t))
{
case FUNCTION_DECL:
  /* Constructors don't have return types.  And conversion functions
 do not have a type-specifier in their return types.  */
  if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t))
pp_cxx_function_specifier (pp, t);
  else if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t)));
  else
default:
pp_c_declaration_specifiers (pp_c_base (pp), t);
  break;
}
}

Though I think this would be better:

static void
pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
{
  switch (TREE_CODE (t))
{
case FUNCTION_DECL:
  /* Constructors don't have return types.  And conversion functions
 do not have a type-specifier in their return types.  */

  if (DECL_CONSTRUCTOR_P (t) || DECL_CONV_FN_P (t))
pp_cxx_function_specifier (pp, t), break;

  if (DECL_NONSTATIC_MEMBER_FUNCTION_P (t))
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (TREE_TYPE (t))), break;
  /* FALLTHROUGH */

default:
  pp_c_declaration_specifiers (pp_c_base (pp), t);
  break;
}
}

It surely looks cleaner to my eyes..


Go patch committed: Pointer to interface type has no methods

2011-03-28 Thread Ian Lance Taylor
In the patch I just committed, I overlooked that a pointer to a named
interface type has no methods, and therefore that you can not use such a
type with a method expression.  This patch corrects that oversight.  To
make the error more clear, I added a '*' to the error output for a
pointer type.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r e1908705ee52 go/expressions.cc
--- a/go/expressions.cc	Mon Mar 28 14:21:14 2011 -0700
+++ b/go/expressions.cc	Mon Mar 28 14:31:26 2011 -0700
@@ -10263,7 +10263,7 @@
   bool is_ambiguous;
   Method* method = nt-method_function(name, is_ambiguous);
   const Typed_identifier* imethod = NULL;
-  if (method == NULL)
+  if (method == NULL  !is_pointer)
 {
   Interface_type* it = nt-interface_type();
   if (it != NULL)
@@ -10273,12 +10273,14 @@
   if (method == NULL  imethod == NULL)
 {
   if (!is_ambiguous)
-	error_at(location, type %%s% has no method %%s%,
+	error_at(location, type %%s%s% has no method %%s%,
+		 is_pointer ? * : ,
 		 nt-message_name().c_str(),
 		 Gogo::message_name(name).c_str());
   else
-	error_at(location, method %%s% is ambiguous in type %%s%,
+	error_at(location, method %%s%s% is ambiguous in type %%s%,
 		 Gogo::message_name(name).c_str(),
+		 is_pointer ? * : ,
 		 nt-message_name().c_str());
   return Expression::make_error(location);
 }


Re: [PING][PATCH, testsuite] Update gcc.dg/stack-usage-1.c SIZE values for powerpc

2011-03-28 Thread Dominique Dhumieres
 Just guessing at the numbers, does the following patch fix the
 failures for you?

As I am currently bootstrapping gcc, I cannot regtest right now, but running the
test manually I get 256 at -m32 (I guess this is right) while I get 272 at -m64
(so the test will fail).

Dominique


Go patch committed: Better errors for missing chan element type

2011-03-28 Thread Ian Lance Taylor
This patch to the Go frontend gives better error messages for the common
error of omitting a channel element type.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 5e8176633433 go/parse.cc
--- a/go/parse.cc	Mon Mar 28 14:34:54 2011 -0700
+++ b/go/parse.cc	Mon Mar 28 14:46:43 2011 -0700
@@ -656,6 +656,23 @@
 	  this-advance_token();
 	}
 }
+
+  // Better error messages for the common error of omitting the
+  // channel element type.
+  if (!this-type_may_start_here())
+{
+  token = this-peek_token();
+  if (token-is_op(OPERATOR_RCURLY))
+	error_at(this-location(), unexpected %}% in channel type);
+  else if (token-is_op(OPERATOR_RPAREN))
+	error_at(this-location(), unexpected %)% in channel type);
+  else if (token-is_op(OPERATOR_COMMA))
+	error_at(this-location(), unexpected comma in channel type);
+  else
+	error_at(this-location(), expected channel element type);
+  return Type::make_error_type();
+}
+
   Type* element_type = this-type();
   return Type::make_channel_type(send, receive, element_type);
 }


Re: [google] Allow relative profile paths. (issue4280074)

2011-03-28 Thread Diego Novillo
Committed to google/main rev 171635.


Re: [committed] Fix PA ior expanders

2011-03-28 Thread Richard Henderson
On 03/27/2011 03:17 PM, John David Anglin wrote:
 +(define_predicate reg_or_ior_operand
 +  (match_code subreg,reg,const_int)
 +{
 +  return (register_operand (op, mode)
 +   || (GET_CODE (op) == CONST_INT  ior_mask_p (INTVAL (op;
 +})
 +

Better written, IMO, as

  (ior (match_operand 0 register_operand)
   (and (match_code const_int)
(match_test ior_mask_p (INTVAL (op)


r~


Go patch committed: Better error message for missing if condition

2011-03-28 Thread Ian Lance Taylor
This patch to the Go frontend gives a better error message when the
condition is omitted from an if statement.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r a05deef47b01 go/parse.cc
--- a/go/parse.cc	Mon Mar 28 15:48:35 2011 -0700
+++ b/go/parse.cc	Mon Mar 28 15:52:15 2011 -0700
@@ -3779,6 +3779,12 @@
 	  if (!this-expression_may_start_here())
 	cond = Expression::make_error(this-location());
 	}
+  if (cond == NULL  this-peek_token()-is_op(OPERATOR_LCURLY))
+	{
+	  error_at(this-location(),
+		   missing condition in if statement);
+	  cond = Expression::make_error(this-location());
+	}
   if (cond == NULL)
 	cond = this-expression(PRECEDENCE_NORMAL, false, false, NULL);
 }


[wwwdocs] PATCH for Re: GCC 4.6.0 Released

2011-03-28 Thread Gerald Pfeifer
Committed.

Gerald

Index: index.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/index.html,v
retrieving revision 1.781
diff -u -3 -p -r1.781 index.html
--- index.html  25 Mar 2011 19:56:41 -  1.781
+++ index.html  28 Mar 2011 23:31:12 -
@@ -115,7 +115,7 @@ Any additions?  Don't be shy, send them 
 /dtdd
   Status:
   !--GCC 4.6 status below--
-  a href=http://gcc.gnu.org/ml/gcc/2011-03/msg00176.html;2011-03-14/a
+  a href=http://gcc.gnu.org/ml/gcc/2011-03/msg00439.html;2011-03-28/a
   !--GCC 4.6 status above--
   (regression fixes and docs only).
   br /


Re: [committed] Fix PA ior expanders

2011-03-28 Thread John David Anglin
 You've already got an ior_operand, which has a redundant test for CONST_INT.
 Actually, this is true of quite a few of the PA predicates...

Quite true.  The predicates were originally derived from the code
in pa.md without a significant review.

I'll look at implementing your suggestion.

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


[gc-improv] [PATCH] Separate function RTL memory

2011-03-28 Thread Laurynas Biveinis
This is a first attempt to separate function RTL and make it default. This 
patch is enough for --disable-bootstrap --enable-languages=c to complete on 
Linux x64, but there still remains some RTL that is allocated on function 
obstack when it should be permanent instead.

The patch disables sharing of CONST_VECTOR rtxes. If that impacts memory usage 
too much, a new hash table can be introduced for storing them. That is for 
later, though.

Committed to gc-improv.

2011-03-29  Laurynas Biveinis  laurynas.bivei...@gmail.com

* rtl.h (use_rtl_permanent_mem): New.
(use_rtl_function_mem): New.
(allocate_in_rtl_permanent_mem): New.
(free_rtl_function_mem): New.
(discard_rtx_lists): New.

* rtl.c (obstack_nesting_level): New.
(function_ob_first_obj): New.
(init_rtl): Set function_ob_first_obj and obstack_nesting_level.
(use_rtl_permanent_mem): New.
(use_rtl_function_mem): New.
(allocate_in_rtl_permanent_mem): New.
(copy_rtx_to_permanent_mem): Use use_rtl_permanent_mem and
use_rtl_function_mem.
(strdup_to_permanent_mem): Likewise.
(free_rtl_function_mem): New.
(copy_rtx): Do not share CONST_VECTOR rtxes.

* alias.c (init_alias_target): Allocate RTXes in permanent RTL
memory.

* cselib.c (cselib_init): Likewise.

* config/i386/i386.c (ix86_init_machine_status): Likewise.
(ix86_tls_get_addr): Likewise.
(ix86_tls_module_base): Likewise.

* cfgloopanal.c (init_set_costs): Likewise.

* cfgexpand.c (expand_debug_expr): Likewise.

* caller-save.c (init_caller_save): Likewise.

* gcse.c (can_assign_to_reg_without_clobbers_p): Likewise.

* tree-ssa-address.c (gen_addr_rtx): Likewise.
(addr_for_mem_ref): Likewise.

* reginfo.c (init_fake_stack_mems): Likewise.

* varasm.c (make_decl_rtl): Likewise.
(build_constant_desc): Likewise.
(force_const_mem): Use RTL permanent memory for shared constant
pool.

* lists.c (discard_rtx_lists): New.

* gengenrtl.c (special_rtx): Add CONST to specially handled
rtxes.

* function.h (struct function): New field spill_slot_decl.

* function.c (free_after_compilation): Call free_rtl_function_mem
and discard_rtx_lists.

* emit-rtl.c (gen_rtx_CONST): New.
(gen_rtx_CONST_INT): Perform the gen_rtx_raw_CONST_INT call using
permanent RTL memory.
(const_double_from_real_value): Allocate RTXes in permanent RTL
memory.
(immed_double_const): Likewise.
(spill_slot_decl): Removed.
(get_spill_slot_decl): Use cfun-spill_slot_decl.
(init_emit_regs): Allocate RTXes in permanent RTL memory.
(init_emit_once): Likewise..
(gen_hard_reg_clobber): Likewise.

* dwarf2out.c (add_AT_addr): Copy addr to permanent RTL memory.
(mem_loc_descriptor): Copy rtl to permanent RTL memory.
(loc_list_from_tree): Likewise.
(gen_variable_die): Perform the plus_constant calls using
permanent RTL memory.
Index: gengenrtl.c
===
--- gengenrtl.c	(revision 170593)
+++ gengenrtl.c	(working copy)
@@ -128,7 +128,8 @@
 	  || strcmp (defs[idx].enumname, REG) == 0
 	  || strcmp (defs[idx].enumname, SUBREG) == 0
 	  || strcmp (defs[idx].enumname, MEM) == 0
-	  || strcmp (defs[idx].enumname, CONST_VECTOR) == 0);
+	  || strcmp (defs[idx].enumname, CONST_VECTOR) == 0
+	  || strcmp (defs[idx].enumname, CONST) == 0);
 }
 
 /* Return nonzero if the RTL code given by index IDX is one that we should
Index: lists.c
===
--- lists.c	(revision 170593)
+++ lists.c	(working copy)
@@ -213,3 +213,11 @@
 
   return elem;
 }
+
+/* Discards the cache lists once the RTXes in them are freed.  */
+void
+discard_rtx_lists (void)
+{
+  unused_insn_list = NULL;
+  unused_expr_list = NULL;
+}
Index: cfgloopanal.c
===
--- cfgloopanal.c	(revision 170593)
+++ cfgloopanal.c	(working copy)
@@ -335,6 +335,8 @@
   rtx mem = validize_mem (gen_rtx_MEM (SImode, addr));
   unsigned i;
 
+  use_rtl_permanent_mem ();
+
   target_avail_regs = 0;
   target_clobbered_regs = 0;
   for (i = 0; i  FIRST_PSEUDO_REGISTER; i++)
@@ -373,7 +375,9 @@
   end_sequence ();
   target_spill_cost [speed] = seq_cost (seq, speed);
 }
+
   default_rtl_profile ();
+  use_rtl_function_mem ();
 }
 
 /* Estimates cost of increased register pressure caused by making N_NEW new
Index: caller-save.c
===
--- caller-save.c	(revision 170594)
+++ caller-save.c	(working copy)
@@ -192,6 +192,8 @@
 
   caller_save_initialized_p = true;
 
+  use_rtl_permanent_mem ();
+
   CLEAR_HARD_REG_SET (no_caller_save_reg_set);
   

Re: [PING][PATCH, testsuite] Update gcc.dg/stack-usage-1.c SIZE values for powerpc

2011-03-28 Thread Dominique Dhumieres
 Ok, slightly updated.  How about this? ...

It did not work either at -m64, but the following one seems to work
(manual testing):

--- /opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/stack-usage-1.c2011-03-28 
20:27:57.0 +0200
+++ /opt/gcc/work/gcc/testsuite/gcc.dg/stack-usage-1.c  2011-03-29 
07:35:59.0 +0200
@@ -30,12 +30,17 @@
 #  else
 #define SIZE 248
 #  endif
-#elif defined (__powerpc64__) || defined (__PPC64__)
+#elif defined (__powerpc64__) || defined (__ppc64__) || defined 
(__POWERPC64__) \
+  || defined (__PPC64__)
 #  define SIZE 180
 #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
   || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
 #  if defined (__ALTIVEC__)
-#define SIZE 220
+#if defined (__APPLE__)
+#  define SIZE 204
+#else
+#  define SIZE 220
+#endif
 #  else
 #define SIZE 240
 #  endif

which gives 

stack-usage-1.c:59:5:foo256 static

for both -m32 and -m64

Dominique