Re: [PATCH, PR49121] [4.7 Regression] FAIL: gcc.dg/tree-ssa/ivopt_infer_2.c scan-tree-dump-times ivopts "Replacing" 0

2011-05-24 Thread Zdenek Dvorak
Hi,

> The analysis is correct, and the test case needs to be adapted.
> 
> I adapted the testcase such that it still replaces the exit test if 'a' is
> declared as 'char a[400]', but not if it is declared as 'extern char a[]'.
> 
> ok for trunk?

OK,

Zdenek


Re: [PATCH] get rid of some TYPE_ARG_TYPES usage by introducing nth_arg_type

2011-05-24 Thread Tobias Burnus
On Mon 23 May 2011, Nathan Froyd wrote:
> Various places in the compiler grab TYPE_ARG_TYPES and grovel through it
> when what they're really trying to do is index into the list of argument
> types.  The patch below introduces nth_arg_type for such situatiosn and
> changes a hodgepodge of places to use it.  You could, of course, use
> function_args_iterator, but I think this approach is somewhat clearer.
> 
> Tested on x86_64-unknown-linux-gnu.  OK to commit?

> gcc/fortran/
>   * trans-decl.c (create_main_function): Call nth_arg_type.

The Fortran part is OK.

Thanks for the cleanup!

Tobias



Re: [patch ada]: Fix bootstrap for Ada

2011-05-24 Thread Arnaud Charlet
> this patch fixes an obvious bootstrap issue caused by trying to assign
> a constant pointer to an none-constant.
> 
> Index: adaint.c
> ===
> 
> --- adaint.c(revision 174060)
> +++ adaint.c(working copy)
> @@ -3367,8 +3367,8 @@
>  char *
>  __gnat_to_canonical_file_list_next (void)
>  {
> -  static char *empty = "";
> -  return empty;
> +  static char empty[1];
> +  return &empty[0];
>  }

I'm confused. The above looks wrong to me: it does not return an empty string,
it returns a pointer to an uninitialized string, which cannot be right (and
should generate a warning :-)

Arno


Re: [Patch, libfortran] PR 48931 Async-signal-safety of backtrace signal handler

2011-05-24 Thread Janne Blomqvist
On Sun, May 22, 2011 at 23:21, FX  wrote:
> Dear Janne,
>
> Sorry I'm a bit late on this, but since async-signal-safe code is so hard to 
> get right (at least for me), I wanted to help review your new code. It's very 
> nice to have this instead of my initial ugly implementation, and I have only 
> spotted on issue: AFAICT, execvp() is not safe to use here; only execle() and 
> execve() are.

Ah, good catch! That's a bit of a bummer though, since the nice thing
about execvp() is that it searches the path for the executable, so
it'll work even if the user has addr2line installed somewhere else
than /usr/bin. For execve(), one needs to provide an absolute path.

One solution could be to search the PATH for addr2line during library
initialization (where we don't need to be async-signal-safe), and then
store it somewhere and use it in show_backtrace().

-- 
Janne Blomqvist


Re: [patch ada]: Fix bootstrap for Ada

2011-05-24 Thread Jakub Jelinek
On Tue, May 24, 2011 at 11:25:20AM +0200, Arnaud Charlet wrote:
> > this patch fixes an obvious bootstrap issue caused by trying to assign
> > a constant pointer to an none-constant.
> > 
> > --- adaint.c(revision 174060)
> > +++ adaint.c(working copy)
> > @@ -3367,8 +3367,8 @@
> >  char *
> >  __gnat_to_canonical_file_list_next (void)
> >  {
> > -  static char *empty = "";
> > -  return empty;
> > +  static char empty[1];
> > +  return &empty[0];
> >  }
> 
> I'm confused. The above looks wrong to me: it does not return an empty string,
> it returns a pointer to an uninitialized string, which cannot be right (and
> should generate a warning :-)

No, static vars are implicitly zero initialized when not explicitly
initialized.

Jakub


Re: [Patch, libfortran] PR 48931 Async-signal-safety of backtrace signal handler

2011-05-24 Thread FX
> Ah, good catch! That's a bit of a bummer though, since the nice thing
> about execvp() is that it searches the path for the executable, so
> it'll work even if the user has addr2line installed somewhere else
> than /usr/bin. For execve(), one needs to provide an absolute path.

Yes, I know. Sorry :)

> One solution could be to search the PATH for addr2line during library
> initialization (where we don't need to be async-signal-safe), and then
> store it somewhere and use it in show_backtrace().

That's one way. Another way is just to store a copy of the PATH during 
initialization, and only search addr2line when really needed (which can be done 
with a static buffer and a series of call to execve(), can't it?)

FX


[google] Disable getpagesize() for Android toolchain (issue4515131)

2011-05-24 Thread Guozhi Wei
Hi

This patch is for google/main.

In order to be compatible with current bionic and sysroot, we need to disable
getpagesize(). After getpagesize() in bionic is changed and ndk contains that
change, we can reenable it.

Jing can give more details about it.

This patch has been tested on arm qemu without regression.

thanks
Carrot

2011-05-24  Jing Yu  

* ChangeLog.google-main: New file.
* getpagesize.c(getpagesize): Disable it for bionic.


Index: ChangeLog.google-main
===
--- ChangeLog.google-main   (revision 0)
+++ ChangeLog.google-main   (revision 0)
@@ -0,0 +1,5 @@
+Copyright (C) 2011 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
Index: getpagesize.c
===
--- getpagesize.c   (revision 174099)
+++ getpagesize.c   (working copy)
@@ -60,11 +60,13 @@ BUGS
 # endif /* PAGESIZE */
 #endif /* GNU_OUR_PAGESIZE */
 
+#if DEFAULT_LIBC != LIBC_BIONIC
 int
 getpagesize (void)
 {
   return (GNU_OUR_PAGESIZE);
 }
+#endif
 
 #else /* VMS */
 

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


Re: [patch ada]: Fix bootstrap for Ada

2011-05-24 Thread Arnaud Charlet
> > I'm confused. The above looks wrong to me: it does not return an empty
> > string,
> > it returns a pointer to an uninitialized string, which cannot be right
> > (and
> > should generate a warning :-)
> 
> No, static vars are implicitly zero initialized when not explicitly
> initialized.

Hmm I see. Still, the above code is not easy to read IMO.

I'd suggest instead the following which is easier to read and understand:

__gnat_to_canonical_file_list_next (void)
{
  static char empty[] = "";
  return empty;
}

That's actually a change I was about to commit since we've done it recently
at AdaCore, so OK with the above variant.

Arno


[v3] Update _GLIBCXX_NOTHROW for noexcept

2011-05-24 Thread Paolo Carlini

Hi,

straightforward update of the _GLIBCXX_NOTHROW macro. Without changing 
anything else, on x86_64-linux it provides the following small but 
measurable improvements to the size of the .so and the .a:


.so: 6223484 -> 6223156
.a: 15183284 -> 15182676

Tested x86_64-linux, committed.

Thanks,
Paolo.

/

2011-05-24  Paolo Carlini  

* include/bits/c++config (_GLIBCXX_NOTHROW): Update for noexcept.
* testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error
line number.

Index: include/bits/c++config
===
--- include/bits/c++config  (revision 174105)
+++ include/bits/c++config  (working copy)
@@ -52,10 +52,9 @@
 # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
 #endif
 
+// See below for C++
 #ifndef _GLIBCXX_NOTHROW
-# ifdef __cplusplus
-#  define _GLIBCXX_NOTHROW throw()
-# else
+# ifndef __cplusplus
 #  define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
 # endif
 #endif
@@ -110,6 +109,10 @@
 # endif
 #endif
 
+#ifndef _GLIBCXX_NOTHROW
+# define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT
+#endif
+
 // Macro for extern template, ie controling template linkage via use
 // of extern keyword on template declaration. As documented in the g++
 // manual, it inhibits all implicit instantiations and is used
Index: testsuite/ext/profile/mutex_extensions_neg.cc
===
--- testsuite/ext/profile/mutex_extensions_neg.cc   (revision 174105)
+++ testsuite/ext/profile/mutex_extensions_neg.cc   (working copy)
@@ -25,4 +25,4 @@
 
 #include 
 
-// { dg-error "multiple inlined namespaces" "" { target *-*-* } 252 }
+// { dg-error "multiple inlined namespaces" "" { target *-*-* } 255 }


Re: RFA (libstdc++): C++/v3 PATCH for c++/24163 (lookup in dependent bases) and c++/29131

2011-05-24 Thread Paolo Carlini

On 05/24/2011 05:59 AM, Jason Merrill wrote:
It occurred to me today that I could use current_class_name rather 
than TYPE_IDENTIFIER (current_class_type).
Thus I suppose the below is also ok and obvious? To be safe, I'm testing 
it on x86_64-linux.


Paolo.

//
2011-05-24  Paolo Carlini  

* decl.c (grokdeclarator): Use current_class_name.
Index: decl.c
===
--- decl.c  (revision 174105)
+++ decl.c  (working copy)
@@ -9910,7 +9910,7 @@ grokdeclarator (const cp_declarator *declarator,
   instantiation made the field's type be incomplete.  */
if (current_class_type
&& TYPE_NAME (current_class_type)
-   && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (current_class_type))
+   && IDENTIFIER_TEMPLATE (current_class_name)
&& declspecs->type
&& declspecs->type == type)
  error ("  in instantiation of template %qT",


Re: [patch] Fix var-tracking with dynamic stack realignment on x86

2011-05-24 Thread Eric Botcazou
> Here is an alternative, almost completely untested, patch, which
> uses DW_OP_fbreg  for the arguments of dynamically realigned functions.
> draptest.c now works...

Thanks for the tip.  I completely overlooked this CFA-based machinery and now 
agree that it's the most sensible approach.  For my defense, I would point out 
that it's quite lightly documented. :-)  I've attached a patch that adds a 
blurb about it (as well as contains the fp_cfa_offset adjustment we both have 
in our patches).  I'll install it as obvious if you don't have any objection.

Now on to a few questions:

> 2011-05-23  Jakub Jelinek  
>
>   * var-tracking.c (vt_add_function_parameter): Remap incoming
>   MEMs with crtl->args.internal_arg_pointer based address
>   if stack_realign_drap to arg_pointer_rtx.
>   (vt_init_cfa_base): Add equate argument, don't equate cfa_base_rtx
>   to hfp/sp if it is false.
>   (vt_initialize): Adjust vt_init_cfa_base callers, don't call
>   vt_init_cfa_base if frame_pointer_needed, but fp_cfa_offset is -1,
>   set fp_cfa_offset to -1 if fp/argp hasn't been eliminated.

Why setting CFA_BASE_RTX here?  The remapping in vt_add_function_parameter 
doesn't seem to need it.  Is that necessary so that the processing of MEMs is 
short-circuited elsewhere?  If so, would this be correct in the whole function 
given that the MEMs aren't adjusted in this case (i.e. compute_cfa_pointer is 
never called)?


* var-tracking.c (compute_cfa_pointer): Adjust head comment.
(vt_initialize):  Set PROLOGUE_BB unconditionally.
Add block comment about CFA_BASE_RTX machinery.
Reset FP_CFA_OFFSET to -1 on all invalid paths.
Call vt_init_cfa_base only if FP_CFA_OFFSET isn't equal to -1.


-- 
Eric Botcazou
Index: var-tracking.c
===
--- var-tracking.c	(revision 174058)
+++ var-tracking.c	(working copy)
@@ -705,7 +705,8 @@ vt_stack_adjustments (void)
 static rtx cfa_base_rtx;
 static HOST_WIDE_INT cfa_base_offset;
 
-/* Compute a CFA-based value for the stack pointer.  */
+/* Compute a CFA-based value for an ADJUSTMENT made to stack_pointer_rtx
+   or hard_frame_pointer_rtx.  */
 
 static inline rtx
 compute_cfa_pointer (HOST_WIDE_INT adjustment)
@@ -8664,7 +8665,7 @@ vt_init_cfa_base (void)
 static bool
 vt_initialize (void)
 {
-  basic_block bb, prologue_bb = NULL;
+  basic_block bb, prologue_bb = single_succ (ENTRY_BLOCK_PTR);
   HOST_WIDE_INT fp_cfa_offset = -1;
 
   alloc_aux_for_blocks (sizeof (struct variable_tracking_info_def));
@@ -8722,6 +8723,15 @@ vt_initialize (void)
 
   CLEAR_HARD_REG_SET (argument_reg_set);
 
+  /* In order to shield ourselves from adjustments to the stack pointer or to
+ the hard frame pointer that aren't meant to change the base location of
+ variables, we're going to rewrite MEMs based on them into MEMs based on
+ the CFA by de-eliminating stack_pointer_rtx or hard_frame_pointer_rtx to
+ the virtual CFA pointer frame_pointer_rtx resp. arg_pointer_rtx.  We can
+ do this either when there is no frame pointer in the function and stack
+ adjustments are consistent for all basic blocks or when there is a frame
+ pointer and no stack realignment.  In any case, we first have to check
+ that frame_pointer_rtx resp. arg_pointer_rtx has been eliminated.  */
   if (!frame_pointer_needed)
 {
   rtx reg, elim;
@@ -8764,10 +8774,11 @@ vt_initialize (void)
 	}
 	  if (elim != hard_frame_pointer_rtx)
 	fp_cfa_offset = -1;
-	  else
-	prologue_bb = single_succ (ENTRY_BLOCK_PTR);
 	}
+  else
+	fp_cfa_offset = -1;
 }
+
   if (frame_pointer_needed)
 {
   rtx insn;
@@ -8870,7 +8881,8 @@ vt_initialize (void)
 		  if (bb == prologue_bb
 		  && hard_frame_pointer_adjustment == -1
 		  && RTX_FRAME_RELATED_P (insn)
-		  && fp_setter (insn))
+		  && fp_setter (insn)
+		  && fp_cfa_offset != -1)
 		{
 		  vt_init_cfa_base ();
 		  hard_frame_pointer_adjustment = fp_cfa_offset;


Re: [patch] Fix var-tracking with dynamic stack realignment on x86

2011-05-24 Thread Jakub Jelinek
On Tue, May 24, 2011 at 12:59:57PM +0200, Eric Botcazou wrote:
> Now on to a few questions:
> 
> > 2011-05-23  Jakub Jelinek  
> >
> > * var-tracking.c (vt_add_function_parameter): Remap incoming
> > MEMs with crtl->args.internal_arg_pointer based address
> > if stack_realign_drap to arg_pointer_rtx.
> > (vt_init_cfa_base): Add equate argument, don't equate cfa_base_rtx
> > to hfp/sp if it is false.
> > (vt_initialize): Adjust vt_init_cfa_base callers, don't call
> > vt_init_cfa_base if frame_pointer_needed, but fp_cfa_offset is -1,
> > set fp_cfa_offset to -1 if fp/argp hasn't been eliminated.
> 
> Why setting CFA_BASE_RTX here?  The remapping in vt_add_function_parameter 
> doesn't seem to need it.  Is that necessary so that the processing of MEMs is 
> short-circuited elsewhere?  If so, would this be correct in the whole 
> function 
> given that the MEMs aren't adjusted in this case (i.e. compute_cfa_pointer is 
> never called)?

That is so that the argp (or framep) will be properly handled during CSELIB,
as constant VALUE that is never changed through the function.  And
additionally to find out if we can do the replacement (we can't if
argp resp. framep isn't eliminated and could therefore occur in the real
code).

> -/* Compute a CFA-based value for the stack pointer.  */
> +/* Compute a CFA-based value for an ADJUSTMENT made to stack_pointer_rtx
> +   or hard_frame_pointer_rtx.  */

This is certainly fine.

>  static inline rtx
>  compute_cfa_pointer (HOST_WIDE_INT adjustment)
> @@ -8722,6 +8723,15 @@ vt_initialize (void)
>  
>CLEAR_HARD_REG_SET (argument_reg_set);
>  
> +  /* In order to shield ourselves from adjustments to the stack pointer or to
> + the hard frame pointer that aren't meant to change the base location of
> + variables, we're going to rewrite MEMs based on them into MEMs based on
> + the CFA by de-eliminating stack_pointer_rtx or hard_frame_pointer_rtx to
> + the virtual CFA pointer frame_pointer_rtx resp. arg_pointer_rtx.  We can
> + do this either when there is no frame pointer in the function and stack
> + adjustments are consistent for all basic blocks or when there is a frame
> + pointer and no stack realignment.  In any case, we first have to check
> + that frame_pointer_rtx resp. arg_pointer_rtx has been eliminated.  */
>if (!frame_pointer_needed)
>  {
>rtx reg, elim;

This comment is not 100% accurate.  The reason we do that is to use the
much more compact DW_OP_fbreg* if possible compared to huge location lists,
especially for !frame_pointer_needed where the location list would need to
have another entry whenever sp changes.  dwarf2out.c rewrites argp/framep
if eliminated into DW_OP_fbreg (with some offset when needed).

> @@ -8664,7 +8665,7 @@ vt_init_cfa_base (void)
>  static bool
>  vt_initialize (void)
>  {
> -  basic_block bb, prologue_bb = NULL;
> +  basic_block bb, prologue_bb = single_succ (ENTRY_BLOCK_PTR);
>HOST_WIDE_INT fp_cfa_offset = -1;
>  
>alloc_aux_for_blocks (sizeof (struct variable_tracking_info_def));
> @@ -8764,10 +8774,11 @@ vt_initialize (void)
>   }
> if (elim != hard_frame_pointer_rtx)
>   fp_cfa_offset = -1;
> -   else
> - prologue_bb = single_succ (ENTRY_BLOCK_PTR);
>   }
> +  else
> + fp_cfa_offset = -1;
>  }
> +
>if (frame_pointer_needed)
>  {
>rtx insn;
> @@ -8870,7 +8881,8 @@ vt_initialize (void)
> if (bb == prologue_bb
> && hard_frame_pointer_adjustment == -1
> && RTX_FRAME_RELATED_P (insn)
> -   && fp_setter (insn))
> +   && fp_setter (insn)
> +   && fp_cfa_offset != -1)
>   {
> vt_init_cfa_base ();
> hard_frame_pointer_adjustment = fp_cfa_offset;

While I had part of this in my patch too, it is unnecessary, if prologue_bb
is set to non-NULL only when we want to use it, then we know fp_cfa_offset is 
not -1.
By computing prologue_bb always, it will call fp_setter unnecessarily
for every insn in the prologue bb for !frame_pointer_needed or for DRAP.
I guess adding a comment instead of this would be better.

Jakub


Re: [google] Disable getpagesize() for Android toolchain (issue4515131)

2011-05-24 Thread Joseph S. Myers
On Tue, 24 May 2011, Guozhi Wei wrote:

> Index: getpagesize.c
> ===
> --- getpagesize.c (revision 174099)
> +++ getpagesize.c (working copy)
> @@ -60,11 +60,13 @@ BUGS
>  # endif /* PAGESIZE */
>  #endif /* GNU_OUR_PAGESIZE */
>  
> +#if DEFAULT_LIBC != LIBC_BIONIC

This makes no sense to me.  getpagesize.c is in libiberty.  libiberty does 
not include any GCC-specific headers - and in particular, does not include 
tm.h, which is where the definitions of DEFAULT_LIBC and LIBC_BIONIC would 
come from (via tm_defines in config.gcc).

(In any case, I thought it was now accepted that libiberty should stop 
being built for the target, and obviously it doesn't make sense for this 
particular host-side functionality to depend on what the target is.)

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


Re: [Patch, libfortran] PR 48931 Async-signal-safety of backtrace signal handler

2011-05-24 Thread N.M. Maclaren

On May 24 2011, FX wrote:



One solution could be to search the PATH for addr2line during library
initialization (where we don't need to be async-signal-safe), and then
store it somewhere and use it in show_backtrace().


That's one way. Another way is just to store a copy of the PATH during 
initialization, and only search addr2line when really needed (which can 
be done with a static buffer and a series of call to execve(), can't it?)


Well, yes, but it is better design to do as little as possible in such
handlers.  No matter what POSIX says, calling fork or exec is intrinsically
problematic - for example, ANY signal (including SIGCONT!) can cause
chaos if it is received in such circumstances, and the actual rules for
which processes get which signals are foul beyond belief, even when the
term 'rules' makes sense :-(

That favours Janne's approach.

Regards,
Nick Maclaren.



Re: [patch] Fix var-tracking with dynamic stack realignment on x86

2011-05-24 Thread Eric Botcazou
> That is so that the argp (or framep) will be properly handled during
> CSELIB, as constant VALUE that is never changed through the function.  And
> additionally to find out if we can do the replacement (we can't if argp
> resp. framep isn't eliminated and could therefore occur in the real code).

OK, thanks for the explanation.

> This comment is not 100% accurate.  The reason we do that is to use the
> much more compact DW_OP_fbreg* if possible compared to huge location lists,
> especially for !frame_pointer_needed where the location list would need to
> have another entry whenever sp changes.  dwarf2out.c rewrites argp/framep
> if eliminated into DW_OP_fbreg (with some offset when needed).

Adjusted.

> While I had part of this in my patch too, it is unnecessary, if prologue_bb
> is set to non-NULL only when we want to use it, then we know fp_cfa_offset
> is not -1. By computing prologue_bb always, it will call fp_setter
> unnecessarily for every insn in the prologue bb for !frame_pointer_needed
> or for DRAP. I guess adding a comment instead of this would be better.

The fp_cfa_offset != -1 was before the call to fp_setter in my first patch. :-)

Revised version attached.

-- 
Eric Botcazou
Index: var-tracking.c
===
--- var-tracking.c	(revision 174058)
+++ var-tracking.c	(working copy)
@@ -705,7 +705,8 @@ vt_stack_adjustments (void)
 static rtx cfa_base_rtx;
 static HOST_WIDE_INT cfa_base_offset;
 
-/* Compute a CFA-based value for the stack pointer.  */
+/* Compute a CFA-based value for an ADJUSTMENT made to stack_pointer_rtx
+   or hard_frame_pointer_rtx.  */
 
 static inline rtx
 compute_cfa_pointer (HOST_WIDE_INT adjustment)
@@ -8664,7 +8665,7 @@ vt_init_cfa_base (void)
 static bool
 vt_initialize (void)
 {
-  basic_block bb, prologue_bb = NULL;
+  basic_block bb, prologue_bb = single_succ (ENTRY_BLOCK_PTR);
   HOST_WIDE_INT fp_cfa_offset = -1;
 
   alloc_aux_for_blocks (sizeof (struct variable_tracking_info_def));
@@ -8722,6 +8723,16 @@ vt_initialize (void)
 
   CLEAR_HARD_REG_SET (argument_reg_set);
 
+  /* In order to factor out the adjustments made to the stack pointer or to
+ the hard frame pointer and thus be able to use DW_OP_fbreg operations
+ instead of individual location lists, we're going to rewrite MEMs based
+ on them into MEMs based on the CFA by de-eliminating stack_pointer_rtx
+ or hard_frame_pointer_rtx to the virtual CFA pointer frame_pointer_rtx
+ resp. arg_pointer_rtx.  We can do this either when there is no frame
+ pointer in the function and stack adjustments are consistent for all
+ basic blocks or when there is a frame pointer and no stack realignment.
+ But we first have to check that frame_pointer_rtx resp. arg_pointer_rtx
+ has been eliminated.  */
   if (!frame_pointer_needed)
 {
   rtx reg, elim;
@@ -8764,10 +8775,11 @@ vt_initialize (void)
 	}
 	  if (elim != hard_frame_pointer_rtx)
 	fp_cfa_offset = -1;
-	  else
-	prologue_bb = single_succ (ENTRY_BLOCK_PTR);
 	}
+  else
+	fp_cfa_offset = -1;
 }
+
   if (frame_pointer_needed)
 {
   rtx insn;
@@ -8867,7 +8879,8 @@ vt_initialize (void)
 		  VTI (bb)->out.stack_adjust += post;
 		}
 
-		  if (bb == prologue_bb
+		  if (fp_cfa_offset != -1
+		  && bb == prologue_bb
 		  && hard_frame_pointer_adjustment == -1
 		  && RTX_FRAME_RELATED_P (insn)
 		  && fp_setter (insn))


Put more common objects in libcommon-target.a

2011-05-24 Thread Joseph S. Myers
This patch continues preparing for a target structure shared by the
driver (including for this purpose collect2 and gnatbind) and the core
compilers by creating a library libcommon-target.a to contain the
shared code that may have such target dependencies.  Right now it
contains opts-common.o (which doesn't have target dependencies itself
except indirectly through options.o), options.o and prefix.o; it's
intended to include the shared target structure and associated
functions, and opts.o once all the hooks used there
(targetm.handle_option targetm.default_target_flags
targetm.unwind_tables_default targetm.target_option.init_struct
targetm.target_option.optimization_table targetm.except_unwind_info
targetm.have_named_sections targetm.supports_split_stack targetm.help)
have moved to the common structure.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit?

2011-05-24  Joseph Myers  

* Makefile.in (GCC_OBJS): Remove opts-common.o and options.o.
(OBJS): Remove options.o, opts-common.o and prefix.o.
(OBJS-libcommon-target): New.
(ALL_HOST_BACKEND_OBJS): Include $(OBJS-libcommon-target).
(BACKEND): Include libcommon-target.a.
(MOSTLYCLEANFILES): Include libcommon-target.a.
(libcommon-target.a): New.
(xgcc$(exeext), cpp$(exeext)): Use libcommon-target.a instead of
prefix.o.

ada:
2011-05-24  Joseph Myers  

* gcc-interface/Make-lang.in (GNAT1_OBJS): Don't include
$(EXTRA_GNAT1_OBJS).
(GNATBIND_OBJS): Don't include $(EXTRA_GNATBIND_OBJS).
(EXTRA_GNAT1_OBJS, EXTRA_GNATBIND_OBJS): Remove.
(gnat1$(exeext), gnatbind$(exeext)): Use libcommon-target.a.
* gcc-interface/Makefile.in (EXTRA_GNATTOOLS_OBJS): Use
libcommon-target.a instead of prefix.o.

cp:
2011-05-24  Joseph Myers  

* Make-lang.in (GXX_OBJS): Remove prefix.o.
(g++$(exeext)): Use libcommon-target.a.
(CXX_C_OBJS): Remove prefix.o.

fortran:
2011-05-24  Joseph Myers  

* Make-lang.in (GFORTRAN_D_OBJS): Remove prefix.o.
(gfortran$(exeext)): Use libcommon-target.a.

go:
2011-05-24  Joseph Myers  

* Make-lang.in (GCCGO_OBJS): Remove prefix.o.
(gccgo$(exeext)): Use libcommon-target.a.

java:
2011-05-24  Joseph Myers  

* Make-lang.in ($(XGCJ)$(exeext)): Use libcommon-target.a instead
of prefix.o.

Index: gcc/java/Make-lang.in
===
--- gcc/java/Make-lang.in   (revision 174085)
+++ gcc/java/Make-lang.in   (working copy)
@@ -64,9 +64,9 @@ jvspec.o: $(srcdir)/java/jvspec.c $(SYST
 
 # Create the compiler driver for $(XGCJ).
 $(XGCJ)$(exeext): $(GCC_OBJS) jvspec.o java/jcf-path.o \
-  prefix.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
+  libcommon-target.a $(LIBDEPS) $(EXTRA_GCC_OBJS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \
- jvspec.o java/jcf-path.o prefix.o $(EXTRA_GCC_OBJS) $(LIBS)
+ jvspec.o java/jcf-path.o $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBS)
 
 # Create a version of the $(XGCJ) driver which calls the cross-compiler.
 $(XGCJ)-cross$(exeext): $(XGCJ)$(exeext)
Index: gcc/cp/Make-lang.in
===
--- gcc/cp/Make-lang.in (revision 174085)
+++ gcc/cp/Make-lang.in (working copy)
@@ -60,10 +60,10 @@ g++spec.o: $(srcdir)/cp/g++spec.c $(SYST
$(INCLUDES) $(srcdir)/cp/g++spec.c)
 
 # Create the compiler driver for g++.
-GXX_OBJS = $(GCC_OBJS) g++spec.o prefix.o
-g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
+GXX_OBJS = $(GCC_OBJS) g++spec.o
+g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
- $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
+ $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBS)
 
 # Create a version of the g++ driver which calls the cross-compiler.
 g++-cross$(exeext): g++$(exeext)
@@ -72,7 +72,7 @@ g++-cross$(exeext): g++$(exeext)
 
 # The compiler itself.
 # Shared with C front end:
-CXX_C_OBJS = attribs.o incpath.o prefix.o \
+CXX_C_OBJS = attribs.o incpath.o \
$(C_COMMON_OBJS) $(CXX_TARGET_OBJS)
 
 # Language-specific object files for C++ and Objective C++.
Index: gcc/go/Make-lang.in
===
--- gcc/go/Make-lang.in (revision 174085)
+++ gcc/go/Make-lang.in (working copy)
@@ -36,10 +36,10 @@ gospec.o: $(srcdir)/go/gospec.c $(SYSTEM
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/go/gospec.c)
 
-GCCGO_OBJS = $(GCC_OBJS) gospec.o prefix.o
-gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
+GCCGO_OBJS = $(GCC_OBJS) gospec.o
+gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
- $(GCCGO_OBJS) $(EXTRA_GCC_OBJ

Re: Put more common objects in libcommon-target.a

2011-05-24 Thread Paolo Bonzini

On 05/24/2011 01:42 PM, Joseph S. Myers wrote:

This patch continues preparing for a target structure shared by the
driver (including for this purpose collect2 and gnatbind) and the core
compilers by creating a library libcommon-target.a to contain the
shared code that may have such target dependencies.  Right now it
contains opts-common.o (which doesn't have target dependencies itself
except indirectly through options.o), options.o and prefix.o; it's
intended to include the shared target structure and associated
functions, and opts.o once all the hooks used there
(targetm.handle_option targetm.default_target_flags
targetm.unwind_tables_default targetm.target_option.init_struct
targetm.target_option.optimization_table targetm.except_unwind_info
targetm.have_named_sections targetm.supports_split_stack targetm.help)
have moved to the common structure.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit?

2011-05-24  Joseph Myers

* Makefile.in (GCC_OBJS): Remove opts-common.o and options.o.
(OBJS): Remove options.o, opts-common.o and prefix.o.
(OBJS-libcommon-target): New.
(ALL_HOST_BACKEND_OBJS): Include $(OBJS-libcommon-target).
(BACKEND): Include libcommon-target.a.
(MOSTLYCLEANFILES): Include libcommon-target.a.
(libcommon-target.a): New.
(xgcc$(exeext), cpp$(exeext)): Use libcommon-target.a instead of
prefix.o.

ada:
2011-05-24  Joseph Myers

* gcc-interface/Make-lang.in (GNAT1_OBJS): Don't include
$(EXTRA_GNAT1_OBJS).
(GNATBIND_OBJS): Don't include $(EXTRA_GNATBIND_OBJS).
(EXTRA_GNAT1_OBJS, EXTRA_GNATBIND_OBJS): Remove.
(gnat1$(exeext), gnatbind$(exeext)): Use libcommon-target.a.
* gcc-interface/Makefile.in (EXTRA_GNATTOOLS_OBJS): Use
libcommon-target.a instead of prefix.o.

cp:
2011-05-24  Joseph Myers

* Make-lang.in (GXX_OBJS): Remove prefix.o.
(g++$(exeext)): Use libcommon-target.a.
(CXX_C_OBJS): Remove prefix.o.

fortran:
2011-05-24  Joseph Myers

* Make-lang.in (GFORTRAN_D_OBJS): Remove prefix.o.
(gfortran$(exeext)): Use libcommon-target.a.

go:
2011-05-24  Joseph Myers

* Make-lang.in (GCCGO_OBJS): Remove prefix.o.
(gccgo$(exeext)): Use libcommon-target.a.

java:
2011-05-24  Joseph Myers

* Make-lang.in ($(XGCJ)$(exeext)): Use libcommon-target.a instead
of prefix.o.

Index: gcc/java/Make-lang.in
===
--- gcc/java/Make-lang.in   (revision 174085)
+++ gcc/java/Make-lang.in   (working copy)
@@ -64,9 +64,9 @@ jvspec.o: $(srcdir)/java/jvspec.c $(SYST

  # Create the compiler driver for $(XGCJ).
  $(XGCJ)$(exeext): $(GCC_OBJS) jvspec.o java/jcf-path.o \
-  prefix.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
+  libcommon-target.a $(LIBDEPS) $(EXTRA_GCC_OBJS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \
- jvspec.o java/jcf-path.o prefix.o $(EXTRA_GCC_OBJS) $(LIBS)
+ jvspec.o java/jcf-path.o $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBS)

  # Create a version of the $(XGCJ) driver which calls the cross-compiler.
  $(XGCJ)-cross$(exeext): $(XGCJ)$(exeext)
Index: gcc/cp/Make-lang.in
===
--- gcc/cp/Make-lang.in (revision 174085)
+++ gcc/cp/Make-lang.in (working copy)
@@ -60,10 +60,10 @@ g++spec.o: $(srcdir)/cp/g++spec.c $(SYST
$(INCLUDES) $(srcdir)/cp/g++spec.c)

  # Create the compiler driver for g++.
-GXX_OBJS = $(GCC_OBJS) g++spec.o prefix.o
-g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
+GXX_OBJS = $(GCC_OBJS) g++spec.o
+g++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
- $(GXX_OBJS) $(EXTRA_GCC_OBJS) $(LIBS)
+ $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBS)

  # Create a version of the g++ driver which calls the cross-compiler.
  g++-cross$(exeext): g++$(exeext)
@@ -72,7 +72,7 @@ g++-cross$(exeext): g++$(exeext)

  # The compiler itself.
  # Shared with C front end:
-CXX_C_OBJS = attribs.o incpath.o prefix.o \
+CXX_C_OBJS = attribs.o incpath.o \
$(C_COMMON_OBJS) $(CXX_TARGET_OBJS)

  # Language-specific object files for C++ and Objective C++.
Index: gcc/go/Make-lang.in
===
--- gcc/go/Make-lang.in (revision 174085)
+++ gcc/go/Make-lang.in (working copy)
@@ -36,10 +36,10 @@ gospec.o: $(srcdir)/go/gospec.c $(SYSTEM
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/go/gospec.c)

-GCCGO_OBJS = $(GCC_OBJS) gospec.o prefix.o
-gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) $(LIBDEPS)
+GCCGO_OBJS = $(GCC_OBJS) gospec.o
+gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \

Re: [Solaris] Fix profiling

2011-05-24 Thread Eric Botcazou
> Tested on SPARC/Solaris 8 and SPARC64/Solaris 9 (the Solaris 10 machine
> isn't in very good shape right now).

Also tested on SPARC/Solaris 10 now.

-- 
Eric Botcazou


Re: [patch] Fix var-tracking with dynamic stack realignment on x86

2011-05-24 Thread Jakub Jelinek
On Tue, May 24, 2011 at 01:42:11PM +0200, Eric Botcazou wrote:
> > That is so that the argp (or framep) will be properly handled during
> > CSELIB, as constant VALUE that is never changed through the function.  And
> > additionally to find out if we can do the replacement (we can't if argp
> > resp. framep isn't eliminated and could therefore occur in the real code).
> 
> OK, thanks for the explanation.

So, would you like me to redo my patch on top of your patch, test it and
submit?

> > This comment is not 100% accurate.  The reason we do that is to use the
> > much more compact DW_OP_fbreg* if possible compared to huge location lists,
> > especially for !frame_pointer_needed where the location list would need to
> > have another entry whenever sp changes.  dwarf2out.c rewrites argp/framep
> > if eliminated into DW_OP_fbreg (with some offset when needed).
> 
> Adjusted.

Ok.

> > While I had part of this in my patch too, it is unnecessary, if prologue_bb
> > is set to non-NULL only when we want to use it, then we know fp_cfa_offset
> > is not -1. By computing prologue_bb always, it will call fp_setter
> > unnecessarily for every insn in the prologue bb for !frame_pointer_needed
> > or for DRAP. I guess adding a comment instead of this would be better.
> 
> The fp_cfa_offset != -1 was before the call to fp_setter in my first patch. 
> :-)

If you think it makes the code clearer, the extra comparison for at most
each stmt in the prologue_bb is probably noise compile time wise.
> 
> Revised version attached.

Fine with me, but I'm not a reviewer of this part of GCC...

Jakub


Re: [PATCH] split tree_type, a.k.a. "tuplifying types"

2011-05-24 Thread Tom de Vries
On 05/23/2011 05:04 PM, Nathan Froyd wrote:
> On 05/22/2011 02:24 PM, Tom de Vries wrote:
>> Now that struct tree_type does not exist anymore, 'sizeof (struct tree_type)'
>> generates an error in the following assert in fold_checksum_tree:
>> ...
>>   gcc_assert ((sizeof (struct tree_exp) + 5 * sizeof (tree)
>> <= sizeof (struct tree_function_decl))
>>&& sizeof (struct tree_type) <= sizeof (struct 
>> tree_function_decl));
>> ...
>>
>> This error is triggered with -enable-checking=fold.
> 
> Doh.  Thanks for the report.
> 
> The easy fix is s/tree_type/tree_type_non_common/.  But I don't see why the
> assert has to even care about tree_type; doesn't:
> 
>   gcc_assert ((sizeof (struct tree_exp) + 5 * sizeof (tree)
>   <= sizeof (union tree_node));
> 
> accomplish the same thing?
> 
> -Nathan
> 
> 

I don't know for sure what the assert is trying to check, but I'm guessing it's
trying to check that the memcpys are save. A naive implementation would be:

Index: fold-const.c
===
--- fold-const.c(revision 173703)
+++ fold-const.c(working copy)
@@ -13792,6 +13789,7 @@ recursive_label:
   && DECL_ASSEMBLER_NAME_SET_P (expr))
 {
   /* Allow DECL_ASSEMBLER_NAME to be modified.  */
+  gcc_assert (tree_size (expr) <= sizeof (buf));
   memcpy ((char *) &buf, expr, tree_size (expr));
   SET_DECL_ASSEMBLER_NAME ((tree)&buf, NULL);
   expr = (tree) &buf;
@@ -13805,6 +13803,7 @@ recursive_label:
 {
   /* Allow these fields to be modified.  */
   tree tmp;
+  gcc_assert (tree_size (expr) <= sizeof (buf));
   memcpy ((char *) &buf, expr, tree_size (expr));
   expr = tmp = (tree) &buf;
   TYPE_CONTAINS_PLACEHOLDER_INTERNAL (tmp) = 0;

But that turns it into a runtime check.

On the other hand, I'm not sure the original assert still makes sense. Neither
tcc_type nor tcc_declaration have variable size, so the '5 * sizeof (tree)' does
not seem applicable anymore.

If we want checks cheaper than the naive, but more maintainable than the
current, we would want something like:

+  gcc_assert (tree_class_max_size (tcc_declaration) <= sizeof (buf));
+  gcc_assert (tree_class_max_size (tcc_type) <= sizeof (buf));

We would want those checks moved out of the hot path, and we would need to
implement and maintain tree_class_max_size alongside tree_size and
tree_code_size.  But I'm not sure it's worth the effort.

Thanks,
- Tom


Re: [Fwd: Re: [PATCH] Add powi-to-multiply expansion to cse_sincos pass]

2011-05-24 Thread Richard Guenther
On Mon, May 23, 2011 at 11:53 PM, William J. Schmidt
 wrote:
> Richard,
>
> While working on the next patch, I ran into a scenario that will apply
> to this one as well.  If the call statement that calls powi contains
> vdef/vuse information, it is lost by this replacement.  For example,
>
> # .MEM_20 = VDEF <.MEM_19(D)>
> D.1980_3 = __builtin_powf (D.1979_2, 2.0e=0);
>
> is replaced by
>
> powmult.2_27 = D.1979_2 * D.1979_2;
> D.1980_3 = powmult.2_27;
>
> According to my limited understanding, vuse/vdef ops can't be attached
> to a gimple statement that doesn't have memory operands.  Do I need to
> find the # VUSE <.MEM_20> reached by this VDEF and change it to a
> # VUSE <.MEM_19>, in this case?
>
> Any pointers to code for similar situations would be appreciated.

You can do unlink_stmt_vdef (stmt) on the old stmt, that will get rid
of the virtual operands.  I see gsi_replace doesn't do that, but it
probably should.  Can you try

Index: gcc/gimple-iterator.c
===
--- gcc/gimple-iterator.c   (revision 174106)
+++ gcc/gimple-iterator.c   (working copy)
@@ -394,6 +394,7 @@ void
 gsi_replace (gimple_stmt_iterator *gsi, gimple stmt, bool update_eh_info)
 {
   gimple orig_stmt = gsi_stmt (*gsi);
+  tree vop;

   if (stmt == orig_stmt)
 return;
@@ -409,6 +410,13 @@ gsi_replace (gimple_stmt_iterator *gsi,
   if (update_eh_info)
 maybe_clean_or_replace_eh_stmt (orig_stmt, stmt);

+  /* Preserve virtual operands from the original statement, they will
+ be dropped by update_stmt if they are not necessary.  */
+  if ((vop = gimple_vdef (orig_stmt)) != NULL_TREE)
+gimple_set_vdef (stmt, vop);
+  if ((vop = gimple_vuse (orig_stmt)) != NULL_TREE)
+gimple_set_vuse (stmt, vop);
+
   gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt);

   /* Free all the data flow information for ORIG_STMT.  */

?

Richard.

> Thanks,
> Bill
>
>  Forwarded Message 
>> From: William J. Schmidt 
>> To: Richard Guenther 
>> Cc: gcc-patches@gcc.gnu.org
>> Subject: Re: [PATCH] Add powi-to-multiply expansion to cse_sincos pass
>> Date: Mon, 23 May 2011 13:06:31 -0500
>>
>> Richard, thanks for the excellent comments.  I really appreciate your
>> help.  I've implemented them all, and bootstrap/regtest succeeds on
>> powerpc target.  Here's the revised patch for your consideration.
>>
>> Thanks,
>> Bill
>>
>>
>> 2011-05-23  Bill Schmidt  
>>
>>       * tree-ssa-math-opts.c (powi_table): New.
>>       (powi_lookup_cost): New.
>>       (powi_cost): New.
>>       (powi_as_mults_1): New.
>>       (powi_as_mults): New.
>>       (gimple_expand_builtin_powi): New.
>>       (execute_cse_sincos): Add switch case for BUILT_IN_POWI.
>>       (gate_cse_sincos): Remove sincos/cexp restriction.
>>
>> Index: gcc/ChangeLog
>> ===
>> --- gcc/ChangeLog     (revision 174075)
>> +++ gcc/ChangeLog     (working copy)
>> @@ -1,3 +1,14 @@
>> +2011-05-23  Bill Schmidt  
>> +
>> +     * tree-ssa-math-opts.c (powi_table): New.
>> +     (powi_lookup_cost): New.
>> +     (powi_cost): New.
>> +     (powi_as_mults_1): New.
>> +     (powi_as_mults): New.
>> +     (gimple_expand_builtin_powi): New.
>> +     (execute_cse_sincos): Add switch case for BUILT_IN_POWI.
>> +     (gate_cse_sincos): Remove sincos/cexp restriction.
>> +
>>  2011-05-23  Richard Guenther  
>>
>>       * gimple.c (gimple_types_compatible_p_1): Always compare type names.
>> Index: gcc/tree-ssa-math-opts.c
>> ===
>> --- gcc/tree-ssa-math-opts.c  (revision 174075)
>> +++ gcc/tree-ssa-math-opts.c  (working copy)
>> @@ -795,8 +795,243 @@ execute_cse_sincos_1 (tree name)
>>    return cfg_changed;
>>  }
>>
>> +/* To evaluate powi(x,n), the floating point value x raised to the
>> +   constant integer exponent n, we use a hybrid algorithm that
>> +   combines the "window method" with look-up tables.  For an
>> +   introduction to exponentiation algorithms and "addition chains",
>> +   see section 4.6.3, "Evaluation of Powers" of Donald E. Knuth,
>> +   "Seminumerical Algorithms", Vol. 2, "The Art of Computer Programming",
>> +   3rd Edition, 1998, and Daniel M. Gordon, "A Survey of Fast Exponentiation
>> +   Methods", Journal of Algorithms, Vol. 27, pp. 129-146, 1998.  */
>> +
>> +/* Provide a default value for POWI_MAX_MULTS, the maximum number of
>> +   multiplications to inline before calling the system library's pow
>> +   function.  powi(x,n) requires at worst 2*bits(n)-2 multiplications,
>> +   so this default never requires calling pow, powf or powl.  */
>> +
>> +#ifndef POWI_MAX_MULTS
>> +#define POWI_MAX_MULTS  (2*HOST_BITS_PER_WIDE_INT-2)
>> +#endif
>> +
>> +/* The size of the "optimal power tree" lookup table.  All
>> +   exponents less than this value are simply looked up in the
>> +   powi_table below.  This threshold is also used to size the
>> +   cache of pse

Re: [PATCH] Add powi-to-multiply expansion to cse_sincos pass

2011-05-24 Thread Richard Guenther
On Mon, May 23, 2011 at 8:06 PM, William J. Schmidt
 wrote:
> Richard, thanks for the excellent comments.  I really appreciate your
> help.  I've implemented them all, and bootstrap/regtest succeeds on
> powerpc target.  Here's the revised patch for your consideration.
>
> Thanks,
> Bill
>
>
> 2011-05-23  Bill Schmidt  
>
>        * tree-ssa-math-opts.c (powi_table): New.
>        (powi_lookup_cost): New.
>        (powi_cost): New.
>        (powi_as_mults_1): New.
>        (powi_as_mults): New.
>        (gimple_expand_builtin_powi): New.
>        (execute_cse_sincos): Add switch case for BUILT_IN_POWI.
>        (gate_cse_sincos): Remove sincos/cexp restriction.
>
> Index: gcc/ChangeLog
> ===
> --- gcc/ChangeLog       (revision 174075)
> +++ gcc/ChangeLog       (working copy)
> @@ -1,3 +1,14 @@
> +2011-05-23  Bill Schmidt  
> +
> +       * tree-ssa-math-opts.c (powi_table): New.
> +       (powi_lookup_cost): New.
> +       (powi_cost): New.
> +       (powi_as_mults_1): New.
> +       (powi_as_mults): New.
> +       (gimple_expand_builtin_powi): New.
> +       (execute_cse_sincos): Add switch case for BUILT_IN_POWI.
> +       (gate_cse_sincos): Remove sincos/cexp restriction.
> +
>  2011-05-23  Richard Guenther  
>
>        * gimple.c (gimple_types_compatible_p_1): Always compare type names.
> Index: gcc/tree-ssa-math-opts.c
> ===
> --- gcc/tree-ssa-math-opts.c    (revision 174075)
> +++ gcc/tree-ssa-math-opts.c    (working copy)
> @@ -795,8 +795,243 @@ execute_cse_sincos_1 (tree name)
>   return cfg_changed;
>  }
>
> +/* To evaluate powi(x,n), the floating point value x raised to the
> +   constant integer exponent n, we use a hybrid algorithm that
> +   combines the "window method" with look-up tables.  For an
> +   introduction to exponentiation algorithms and "addition chains",
> +   see section 4.6.3, "Evaluation of Powers" of Donald E. Knuth,
> +   "Seminumerical Algorithms", Vol. 2, "The Art of Computer Programming",
> +   3rd Edition, 1998, and Daniel M. Gordon, "A Survey of Fast Exponentiation
> +   Methods", Journal of Algorithms, Vol. 27, pp. 129-146, 1998.  */
> +
> +/* Provide a default value for POWI_MAX_MULTS, the maximum number of
> +   multiplications to inline before calling the system library's pow
> +   function.  powi(x,n) requires at worst 2*bits(n)-2 multiplications,
> +   so this default never requires calling pow, powf or powl.  */
> +
> +#ifndef POWI_MAX_MULTS
> +#define POWI_MAX_MULTS  (2*HOST_BITS_PER_WIDE_INT-2)
> +#endif
> +
> +/* The size of the "optimal power tree" lookup table.  All
> +   exponents less than this value are simply looked up in the
> +   powi_table below.  This threshold is also used to size the
> +   cache of pseudo registers that hold intermediate results.  */
> +#define POWI_TABLE_SIZE 256
> +
> +/* The size, in bits of the window, used in the "window method"
> +   exponentiation algorithm.  This is equivalent to a radix of
> +   (1< +#define POWI_WINDOW_SIZE 3
> +
> +/* The following table is an efficient representation of an
> +   "optimal power tree".  For each value, i, the corresponding
> +   value, j, in the table states than an optimal evaluation
> +   sequence for calculating pow(x,i) can be found by evaluating
> +   pow(x,j)*pow(x,i-j).  An optimal power tree for the first
> +   100 integers is given in Knuth's "Seminumerical algorithms".  */
> +
> +static const unsigned char powi_table[POWI_TABLE_SIZE] =
> +  {
> +      0,   1,   1,   2,   2,   3,   3,   4,  /*   0 -   7 */
> +      4,   6,   5,   6,   6,  10,   7,   9,  /*   8 -  15 */
> +      8,  16,   9,  16,  10,  12,  11,  13,  /*  16 -  23 */
> +     12,  17,  13,  18,  14,  24,  15,  26,  /*  24 -  31 */
> +     16,  17,  17,  19,  18,  33,  19,  26,  /*  32 -  39 */
> +     20,  25,  21,  40,  22,  27,  23,  44,  /*  40 -  47 */
> +     24,  32,  25,  34,  26,  29,  27,  44,  /*  48 -  55 */
> +     28,  31,  29,  34,  30,  60,  31,  36,  /*  56 -  63 */
> +     32,  64,  33,  34,  34,  46,  35,  37,  /*  64 -  71 */
> +     36,  65,  37,  50,  38,  48,  39,  69,  /*  72 -  79 */
> +     40,  49,  41,  43,  42,  51,  43,  58,  /*  80 -  87 */
> +     44,  64,  45,  47,  46,  59,  47,  76,  /*  88 -  95 */
> +     48,  65,  49,  66,  50,  67,  51,  66,  /*  96 - 103 */
> +     52,  70,  53,  74,  54, 104,  55,  74,  /* 104 - 111 */
> +     56,  64,  57,  69,  58,  78,  59,  68,  /* 112 - 119 */
> +     60,  61,  61,  80,  62,  75,  63,  68,  /* 120 - 127 */
> +     64,  65,  65, 128,  66, 129,  67,  90,  /* 128 - 135 */
> +     68,  73,  69, 131,  70,  94,  71,  88,  /* 136 - 143 */
> +     72, 128,  73,  98,  74, 132,  75, 121,  /* 144 - 151 */
> +     76, 102,  77, 124,  78, 132,  79, 106,  /* 152 - 159 */
> +     80,  97,  81, 160,  82,  99,  83, 134,  /* 160 - 167 */
> +     84,  86,  85,  95,  86, 160,  87, 100,  /* 168 - 175 */
> +     88, 113,  89,  98,  90,

[PATCH] Fix PR49078

2011-05-24 Thread Richard Guenther

This fixes PR49078 by restricting the assert in get_alias_set to
the case where it matters.  We know that how types generated during
optimization have TYPE_CANONICAL computed differs from what the LTO
machinery does, the patch documents that and reverts a previous attempt
to fix parts of this inconsistency.

LTO profile-bootstrapped and tested on x86_64-unknown-linux-gnu,
SPEC 2k6 built, applied to trunk.

Richard.

2011-05-24  Richard Guenther  

PR bootstrap/49078
* gimple.c (gimple_register_canonical_type): Revert
previous change.
* alias.c (get_alias_set): Only assert that TYPE_CANONICAL
does not for a tree for the case where it matters.  Cache
pointer-type alias-sets.

Index: gcc/gimple.c
===
--- gcc/gimple.c(revision 174106)
+++ gcc/gimple.c(working copy)
@@ -4779,7 +4802,12 @@ gimple_canonical_type_eq (const void *p1
 /* Register type T in the global type table gimple_types.
If another type T', compatible with T, already existed in
gimple_types then return T', otherwise return T.  This is used by
-   LTO to merge identical types read from different TUs.  */
+   LTO to merge identical types read from different TUs.
+
+   ???  This merging does not exactly match how the tree.c middle-end
+   functions will assign TYPE_CANONICAL when new types are created
+   during optimization (which at least happens for pointer and array
+   types).  */
 
 tree
 gimple_register_canonical_type (tree t)
@@ -4800,25 +4828,6 @@ gimple_register_canonical_type (tree t)
   if (TYPE_CANONICAL (t))
 return TYPE_CANONICAL (t);
 
-  /* For pointer and reference types do as the middle-end does - the
- canonical type is a pointer to the canonical pointed-to type.  */
-  if (TREE_CODE (t) == POINTER_TYPE)
-{
-  TYPE_CANONICAL (t)
- = build_pointer_type_for_mode
- (gimple_register_canonical_type (TREE_TYPE (t)),
-  TYPE_MODE (t), TYPE_REF_CAN_ALIAS_ALL (t));
-  return TYPE_CANONICAL (t);
-}
-  else if (TREE_CODE (t) == REFERENCE_TYPE)
-{
-  TYPE_CANONICAL (t)
- = build_reference_type_for_mode
- (gimple_register_canonical_type (TREE_TYPE (t)),
-  TYPE_MODE (t), TYPE_REF_CAN_ALIAS_ALL (t));
-  return TYPE_CANONICAL (t);
-}
-
   if (gimple_canonical_types == NULL)
 gimple_canonical_types = htab_create_ggc (16381, 
gimple_canonical_type_hash,
  gimple_canonical_type_eq, 0);
Index: gcc/alias.c
===
--- gcc/alias.c (revision 174106)
+++ gcc/alias.c (working copy)
@@ -709,10 +709,8 @@ get_alias_set (tree t)
 
   t = TYPE_CANONICAL (t);
 
-  /* Canonical types shouldn't form a tree nor should the canonical
- type require structural equality checks.  */
-  gcc_checking_assert (TYPE_CANONICAL (t) == t
-  && !TYPE_STRUCTURAL_EQUALITY_P (t));
+  /* The canonical type should not require structural equality checks.  */
+  gcc_checking_assert (!TYPE_STRUCTURAL_EQUALITY_P (t));
 
   /* If this is a type with a known alias set, return it.  */
   if (TYPE_ALIAS_SET_KNOWN_P (t))
@@ -813,11 +811,19 @@ get_alias_set (tree t)
  That's simple and avoids all the above problems.  */
   else if (POINTER_TYPE_P (t)
   && t != ptr_type_node)
-return get_alias_set (ptr_type_node);
+set = get_alias_set (ptr_type_node);
 
   /* Otherwise make a new alias set for this type.  */
   else
-set = new_alias_set ();
+{
+  /* Each canonical type gets its own alias set, so canonical types
+shouldn't form a tree.  It doesn't really matter for types
+we handle specially above, so only check it where it possibly
+would result in a bogus alias set.  */
+  gcc_checking_assert (TYPE_CANONICAL (t) == t);
+
+  set = new_alias_set ();
+}
 
   TYPE_ALIAS_SET (t) = set;
 


Re: [PATCH] Add powi-to-multiply expansion to cse_sincos pass

2011-05-24 Thread William J. Schmidt

On Tue, 2011-05-24 at 14:26 +0200, Richard Guenther wrote:



> > +/* Recursive subroutine of powi_as_mults.  This function takes the
> > +   array, CACHE, of already calculated exponents and an exponent N and
> > +   returns a tree that corresponds to CACHE[1]**N, with type TYPE.  */
> > +
> > +static tree
> > +powi_as_mults_1 (gimple_stmt_iterator *gsi, location_t loc, tree type,
> > +HOST_WIDE_INT n, tree *cache, tree target)
> > +{
> > +  tree op0, op1, ssa_target;
> > +  unsigned HOST_WIDE_INT digit;
> > +  gimple mult_stmt;
> > +
> > +  if (n < POWI_TABLE_SIZE)
> > +{
> > +  if (cache[n])
> > +   return cache[n];
> > +
> > +  ssa_target = make_ssa_name (target, NULL);
> 
> You can hoist the ssa_target creation before the if instead of
> replicating it ...

OK.  The time spent in make_ssa_name will be wasted in the common case
where the value is found in the cache.  But I can restructure the logic
to avoid that.

> 
> > +  cache[n] = ssa_target;
> > +
> > +  op0 = powi_as_mults_1 (gsi, loc, type, n - powi_table[n], cache, 
> > target);
> > +  op1 = powi_as_mults_1 (gsi, loc, type, powi_table[n], cache, target);
> > +}
> > +  else if (n & 1)
> > +{
> > +  digit = n & ((1 << POWI_WINDOW_SIZE) - 1);
> > +  op0 = powi_as_mults_1 (gsi, loc, type, n - digit, cache, target);
> > +  op1 = powi_as_mults_1 (gsi, loc, type, digit, cache, target);
> > +  ssa_target = make_ssa_name (target, NULL);
> 
> here and
> 
> > +}
> > +  else
> > +{
> > +  op0 = powi_as_mults_1 (gsi, loc, type, n >> 1, cache, target);
> > +  op1 = op0;
> > +  ssa_target = make_ssa_name (target, NULL);
> 
> here.
> 
> > +}
> > +
> > +  mult_stmt = gimple_build_assign_with_ops (MULT_EXPR, ssa_target, op0, 
> > op1);
> > +  gsi_insert_before (gsi, mult_stmt, GSI_SAME_STMT);
> > +
> > +  return ssa_target;
> > +}
> > +
> > +/* Convert ARG0**N to a tree of multiplications of ARG0 with itself.
> > +   This function needs to be kept in sync with powi_cost above.  */
> > +
> > +static tree
> > +powi_as_mults (gimple_stmt_iterator *gsi, location_t loc,
> > +  tree arg0, HOST_WIDE_INT n)
> > +{
> > +  tree cache[POWI_TABLE_SIZE], result, type = TREE_TYPE (arg0), target;
> > +  gimple div_stmt;
> > +
> > +  if (n == 0)
> > +return build_real (type, dconst1);
> > +
> > +  memset (cache, 0,  sizeof (cache));
> > +  cache[1] = arg0;
> > +
> > +  target = create_tmp_var (type, "powmult");
> > +  add_referenced_var (target);
> > +
> > +  result = powi_as_mults_1 (gsi, loc, type, (n < 0) ? -n : n, cache, 
> > target);
> > +
> > +  if (n >= 0)
> > +return result;
> > +
> > +  /* If the original exponent was negative, reciprocate the result.  */
> > +  target = create_tmp_var (type, "powmult");
> > +  add_referenced_var (target);
> 
> re-use target from above.
> 

Oops, sorry, that was sloppy.

> > +  target = make_ssa_name (target, NULL);
> > +
> > +  div_stmt = gimple_build_assign_with_ops (RDIV_EXPR, target,
> > +  build_real (type, dconst1),
> > +  result);
> > +  gsi_insert_before (gsi, div_stmt, GSI_SAME_STMT);
> > +
> > +  return target;
> > +}
> > +
> > +/* ARG0 and N are the two arguments to a powi builtin in GSI with
> > +   location info LOC.  If the arguments are appropriate, create an
> > +   equivalent sequence of statements prior to GSI using an optimal
> > +   number of multiplications, and return an expession holding the
> > +   result.  */
> > +
> > +static tree
> > +gimple_expand_builtin_powi (gimple_stmt_iterator *gsi, location_t loc,
> > +   tree arg0, HOST_WIDE_INT n)
> > +{
> > +  /* Avoid largest negative number.  */
> > +  if (n != -n
> > +  && ((n >= -1 && n <= 2)
> > + || (optimize_function_for_speed_p (cfun)
> > + && powi_cost (n) <= POWI_MAX_MULTS)))
> > +return powi_as_mults (gsi, loc, arg0, n);
> > +
> > +  return NULL_TREE;
> > +}
> > +
> >  /* Go through all calls to sin, cos and cexpi and call execute_cse_sincos_1
> > -   on the SSA_NAME argument of each of them.  */
> > +   on the SSA_NAME argument of each of them.  Also expand powi(x,n) into
> > +   an optimal number of multiplies, when n is a constant.  */
> >
> >  static unsigned int
> >  execute_cse_sincos (void)
> > @@ -821,7 +1056,9 @@ execute_cse_sincos (void)
> >  && (fndecl = gimple_call_fndecl (stmt))
> >  && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
> >{
> > - tree arg;
> > + tree arg, arg0, arg1, result;
> > + HOST_WIDE_INT n, n_hi;
> > + location_t loc;
> >
> >  switch (DECL_FUNCTION_CODE (fndecl))
> >{
> > @@ -833,6 +1070,29 @@ execute_cse_sincos (void)
> >cfg_changed |= execute_cse_sincos_1 (arg);
> >  break;
> >
> > +   CASE_FLT_FN (BUILT_IN_POWI):
> > + 

[testsuite] Don't use dg-do run in gcc.dg/vect/pr48172.c

2011-05-24 Thread Rainer Orth
The new gcc.dg/vect/pr48172.c FAILs on Solaris 8/x86 since it cannot be
assembled (Sun as) or executed (GNU as).  The vect.exp driver checks for
this and demotes execution tests to compile tests if necessary, but the
explicit dg-do run defeats this.

Removing the dg-do run fixes this.

Tested with the appropriate runtest invocations on i386-pc-solaris2.8
(compile only) and i386-pc-solaris2.10 (execute), installed on mainline.

Rainer


2011-05-24  Rainer Orth  

* gcc.dg/vect/pr48172.c: Remove dg-do run.

Index: gcc/testsuite/gcc.dg/vect/pr48172.c
===
--- gcc/testsuite/gcc.dg/vect/pr48172.c (revision 174114)
+++ gcc/testsuite/gcc.dg/vect/pr48172.c (working copy)
@@ -1,5 +1,3 @@
-/* { dg-do run } */
-
 extern void *memset(void *s, int c, __SIZE_TYPE__ n);
 extern void abort (void);
 
-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Don't use FORCE_CODE_SECTION_ALIGN on Solaris/x86

2011-05-24 Thread Rainer Orth
While working to move the Solaris libgcc configuration to the toplevel,
I came across the definition of FORCE_CODE_SECTION_ALIGN in
i386/sol2.h.  It refers to a Solaris 2.0 ld bug, which is ancient
history by now.  The definition can simply be removed, as verified by
bootstraps on i386-pc-solaris2.{[89],1[01]} with both as/ld and gas/ld.

The macro is still used in config/mcore/mcore-elf.h, so it cannot be
removed completely.

Installed on mainline.

Rainer


diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -19,16 +19,6 @@ You should have received a copy of the G
 along with GCC; see the file COPYING3.  If not see
 .  */
 
-/* The Solaris 2.0 x86 linker botches alignment of code sections.
-   It tries to align to a 16 byte boundary by padding with 0x0090
-   ints, rather than 0x90 bytes (nop).  This generates trash in the
-   ".init" section since the contribution from crtbegin.o is only 7
-   bytes.  The linker pads it to 16 bytes with a single 0x90 byte, and
-   two 0x0090 ints, which generates a segmentation violation when
-   executed.  This macro forces the assembler to do the padding, since
-   it knows what it is doing.  */
-#define FORCE_CODE_SECTION_ALIGN  asm(ALIGN_ASM_OP "16");
-
 /* Old versions of the Solaris assembler can not handle the difference of
labels in different sections, so force DW_EH_PE_datarel.  */
 #undef ASM_PREFERRED_EH_DATA_FORMAT

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


[PATCH] LTO type canonical cleanup

2011-05-24 Thread Richard Guenther

This removes all remaining name related stuff from canonical type
merging.  It doesn't make sense and causes some merging not to
happen.  Where incomplete types are involved we will have no
direct uses of those types and thus we don't care for TYPE_CANONICAL.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2011-05-24  Richard Guenther  

* gimple.c (compare_type_names_p): Remove for_completion_p arg.
(gimple_compatible_complete_and_incomplete_subtype_p): Remove.
(gimple_types_compatible_p_1): Adjust.
(iterative_hash_canonical_type): Do not bother about complete vs.
incomplete types.
(gimple_canonical_types_compatible_p): Likewise.

Index: gcc/gimple.c
===
--- gcc/gimple.c(revision 174114)
+++ gcc/gimple.c(working copy)
@@ -,33 +,18 @@ gimple_lookup_type_leader (tree t)
true if both types have no names.  */
 
 static bool
-compare_type_names_p (tree t1, tree t2, bool for_completion_p)
+compare_type_names_p (tree t1, tree t2)
 {
   tree name1 = TYPE_NAME (t1);
   tree name2 = TYPE_NAME (t2);
 
-  /* Consider anonymous types all unique for completion.  */
-  if (for_completion_p
-  && (!name1 || !name2))
-return false;
-
   if (name1 && TREE_CODE (name1) == TYPE_DECL)
-{
-  name1 = DECL_NAME (name1);
-  if (for_completion_p
- && !name1)
-   return false;
-}
-  gcc_assert (!name1 || TREE_CODE (name1) == IDENTIFIER_NODE);
+name1 = DECL_NAME (name1);
+  gcc_checking_assert (!name1 || TREE_CODE (name1) == IDENTIFIER_NODE);
 
   if (name2 && TREE_CODE (name2) == TYPE_DECL)
-{
-  name2 = DECL_NAME (name2);
-  if (for_completion_p
- && !name2)
-   return false;
-}
-  gcc_assert (!name2 || TREE_CODE (name2) == IDENTIFIER_NODE);
+name2 = DECL_NAME (name2);
+  gcc_checking_assert (!name2 || TREE_CODE (name2) == IDENTIFIER_NODE);
 
   /* Identifiers can be compared with pointer equality rather
  than a string comparison.  */
@@ -3420,25 +3405,6 @@ gimple_compare_field_offset (tree f1, tr
   return false;
 }
 
-/* If the type T1 and the type T2 are a complete and an incomplete
-   variant of the same type return true.  */
-
-static bool
-gimple_compatible_complete_and_incomplete_subtype_p (tree t1, tree t2)
-{
-  /* If one pointer points to an incomplete type variant of
- the other pointed-to type they are the same.  */
-  if (TREE_CODE (t1) == TREE_CODE (t2)
-  && RECORD_OR_UNION_TYPE_P (t1)
-  && (!COMPLETE_TYPE_P (t1)
- || !COMPLETE_TYPE_P (t2))
-  && TYPE_QUALS (t1) == TYPE_QUALS (t2)
-  && compare_type_names_p (TYPE_MAIN_VARIANT (t1),
-  TYPE_MAIN_VARIANT (t2), true))
-return true;
-  return false;
-}
-
 static bool
 gimple_types_compatible_p_1 (tree, tree, type_pair_t,
 VEC(type_pair_t, heap) **,
@@ -3588,7 +3554,7 @@ gimple_types_compatible_p_1 (tree t1, tr
   state->u.same_p = 1;
 
   /* The struct tags shall compare equal.  */
-  if (!compare_type_names_p (t1, t2, false))
+  if (!compare_type_names_p (t1, t2))
 goto different_types;
 
   /* If their attributes are not the same they can't be the same type.  */
@@ -4391,27 +4357,11 @@ iterative_hash_canonical_type (tree type
   if (TREE_CODE (type) == METHOD_TYPE)
v = iterative_hash_canonical_type (TYPE_METHOD_BASETYPE (type), v);
 
-  /* For result types allow mismatch in completeness.  */
-  if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (type)))
-   {
- v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v);
- v = iterative_hash_name
-   (TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (type))), v);
-   }
-  else
-   v = iterative_hash_canonical_type (TREE_TYPE (type), v);
+  v = iterative_hash_canonical_type (TREE_TYPE (type), v);
 
   for (p = TYPE_ARG_TYPES (type), na = 0; p; p = TREE_CHAIN (p))
{
- /* For argument types allow mismatch in completeness.  */
- if (RECORD_OR_UNION_TYPE_P (TREE_VALUE (p)))
-   {
- v = iterative_hash_hashval_t (TREE_CODE (TREE_VALUE (p)), v);
- v = iterative_hash_name
-   (TYPE_NAME (TYPE_MAIN_VARIANT (TREE_VALUE (p))), v);
-   }
- else
-   v = iterative_hash_canonical_type (TREE_VALUE (p), v);
+ v = iterative_hash_canonical_type (TREE_VALUE (p), v);
  na++;
}
 
@@ -4700,10 +4650,7 @@ gimple_canonical_types_compatible_p (tre
 case FUNCTION_TYPE:
   /* Function types are the same if the return type and arguments types
 are the same.  */
-  if (!gimple_compatible_complete_and_incomplete_subtype_p
-(TREE_TYPE (t1), TREE_TYPE (t2))
- && !gimple_canonical_types_compatible_p
-   (TREE_TYPE (t1), TREE_TYPE (t2)))
+  if (!gimple_canonical_types_compatible_p (TREE_TY

Re: [Solaris] Fix profiling

2011-05-24 Thread Rainer Orth
Hi Eric,

> after http://gcc.gnu.org/ml/gcc-patches/2011-04/msg02139.html profiling uses 
> TLS support where available.  This breaks on SPARC/Solaris 8 and 9 (at least) 
> because the associated libraries aren't linked in.

this is PR gcov-profile/48845.

> Tested on SPARC/Solaris 8 and SPARC64/Solaris 9 (the Solaris 10 machine isn't 
> in very good shape right now), OK for the mainline?
>
>
> 2011-05-22  Eric Botcazou  
>
>   * config/sol2.h (LIB_SPEC): Link TLS support for profiling.

While I've got a testsuite patch to fix this (which also fixes/cleanes
up a couple of other issues in that area), I agree that this should work
out of the box and without the user having to know about such an
implementation detail.

On the other hand, the patch is only necessary for tree profiling,
i.e. with -fprofile-generate, so I'm checking in the following.

Bootstrapped without regressions on i386-pc-solaris2.{[89], 1[01]},
installed on mainline.

Thanks for the patch.

Rainer


2011-05-22  Eric Botcazou  
Rainer Orth  

PR gcov-profile/48845
* config/sol2.h (LIB_SPEC): Link TLS support for tree profiling.

diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -136,6 +136,8 @@ along with GCC; see the file COPYING3.  
%{!symbolic:\
  %{pthreads|pthread:" \
 LIB_THREAD_LDFLAGS_SPEC " -lpthread " LIB_TLS_SPEC "} \
+ %{fprofile-generate*:" \
+LIB_THREAD_LDFLAGS_SPEC " " LIB_TLS_SPEC "} \
  %{p|pg:-ldl} -lc}"
 
 #undef  ENDFILE_SPEC

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


[google/integration] Add placeholder -Wself-assign flag for compatibility with other branches

2011-05-24 Thread Simon Baldwin
Add placeholder -Wself-assign flag for compatibility with other branches.

Add -Wself-assign to common.opts so that invocations of gcc with the flag
do not cause compilation to fail.  The flag is silently ignored.

OK for google/integration?

gcc/ChangeLog.google-integration:
2011-05-24  Simon Baldwin  

* common.opt (-Wself-assign): New placeholder flag.


Index: gcc/common.opt
===
--- gcc/common.opt  (revision 174116)
+++ gcc/common.opt  (working copy)
@@ -561,6 +561,13 @@ Wpadded
 Common Var(warn_padded) Warning
 Warn when padding is required to align structure members
 
+; FIXME.  The following -Wself-assign flag is a placeholder to prevent
+; confusing the compiler when applications are built with these flags.
+; Actual support for this flag is found in the google/main branch.
+Wself-assign
+Common Var(warn_self_assign) Init(0) Warning
+Warn when a variable is assigned to itself
+
 Wshadow
 Common Var(warn_shadow) Warning
 Warn when one local variable shadows another


Re: [google/integration] Add placeholder -Wself-assign flag for compatibility with other branches

2011-05-24 Thread Diego Novillo
On Tue, May 24, 2011 at 11:59, Simon Baldwin  wrote:

> gcc/ChangeLog.google-integration:
> 2011-05-24  Simon Baldwin  
>
>        * common.opt (-Wself-assign): New placeholder flag.

OK.


Diego.


Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld

2011-05-24 Thread Rainer Orth
Uros,

> Since handling of "p" is not conditional (that is, controlled by some
> compile flag), it is IMO better to just output correct assembly from
> the insn pattern itself.  You will also output lower-case "@plt" which

I think I tried something along these lines, but failed with duplicate
@plt@plt for PIC code.

> is IIRC preferred by Sun assebler.

I've never seen such an issue.

> Something like attached (untested) patch.

Unfortunately, the Solaris 10/x86 bootstrap fails in the stage1 libgomp:

/vol/gcc/src/hg/trunk/solaris/libgomp/single.c: In function 'GOMP_single_start':
/vol/gcc/src/hg/trunk/solaris/libgomp/single.c:55:1: internal compiler error: ou
tput_operand: '%&' used without any local dynamic TLS references

Rainer

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


Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld

2011-05-24 Thread Uros Bizjak
On Tue, May 24, 2011 at 5:09 PM, Rainer Orth
 wrote:

>> Since handling of "p" is not conditional (that is, controlled by some
>> compile flag), it is IMO better to just output correct assembly from
>> the insn pattern itself.  You will also output lower-case "@plt" which
>
> I think I tried something along these lines, but failed with duplicate
> @plt@plt for PIC code.

Hm, there is no %P1 present, so I don't think this should be an issue.

>> is IIRC preferred by Sun assebler.
>
> I've never seen such an issue.

OK, it is your call... please change @plt to @PLT if desired.

>> Something like attached (untested) patch.
>
> Unfortunately, the Solaris 10/x86 bootstrap fails in the stage1 libgomp:
>
> /vol/gcc/src/hg/trunk/solaris/libgomp/single.c: In function 
> 'GOMP_single_start':
> /vol/gcc/src/hg/trunk/solaris/libgomp/single.c:55:1: internal compiler error: 
> ou
> tput_operand: '%&' used without any local dynamic TLS references

Yeah, I found the problem in tlsgdplt template, please find attached
new version of the patch...

Uros.
Index: i386.md
===
--- i386.md (revision 174119)
+++ i386.md (working copy)
@@ -12367,6 +12367,12 @@
 {
   output_asm_insn
 ("lea{l}\t{%a2@tlsgd(,%1,1), %0|%0, %a2@tlsgd[%1*1]}", operands);
+  if (TARGET_SUN_TLS)
+#ifdef HAVE_AS_IX86_TLSGDPLT
+return "call\t%a2@tlsgdplt";
+#else
+return "call\t%a3@plt";
+#endif
   return "call\t%P3";
 }
   [(set_attr "type" "multi")
@@ -12397,6 +12403,8 @@
 ("lea{q}\t{%a1@tlsgd(%%rip), %%rdi|rdi, %a1@tlsgd[rip]}", operands);
   fputs (ASM_SHORT "0x\n", asm_out_file);
   fputs ("\trex64\n", asm_out_file);
+  if (TARGET_SUN_TLS)
+return "call\t%a2@plt";
   return "call\t%P2";
 }
   [(set_attr "type" "multi")
@@ -12424,6 +12432,12 @@
 {
   output_asm_insn
 ("lea{l}\t{%&@tlsldm(%1), %0|%0, %&@tlsldm[%1]}", operands);
+  if (TARGET_SUN_TLS)
+#ifdef HAVE_AS_IX86_TLSLDMPLT
+return "call\t%&@tlsldmplt";
+#else
+return "call\t%a2@plt";
+#endif
   return "call\t%P2";
 }
   [(set_attr "type" "multi")
@@ -12450,6 +12464,8 @@
 {
   output_asm_insn
 ("lea{q}\t{%&@tlsld(%%rip), %%rdi|rdi, %&@tlsld[rip]}", operands);
+  if (TARGET_SUN_TLS)
+return "call\t%a1@plt";
   return "call\t%P1";
 }
   [(set_attr "type" "multi")


[PATCH, i386]: Fix PR 49133

2011-05-24 Thread Uros Bizjak
Hello!

shufpd can't be used to implement sse2_loadhpd pattern, since shufpd
can move input, matched to output only to the lower half of the
vector.

2011-05-24  Uros Bizjak  

PR target/49133
* config/i386/sse.md (sse2_loadhpd): Remove shufpd alternative.

testsuite/ChangeLog:

2011-05-24  Uros Bizjak  

PR target/49133
* g++.dg/other/pr49133.C: New test.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to SVN mainline, will
be backported to release branches.

Uros.


Re: [Fwd: Re: [PATCH] Add powi-to-multiply expansion to cse_sincos pass]

2011-05-24 Thread William J. Schmidt

On Tue, 2011-05-24 at 16:44 +0200, Richard Guenther wrote:
> On Tue, May 24, 2011 at 3:38 PM, William J. Schmidt
>  wrote:
> >
> > On Tue, 2011-05-24 at 15:11 +0200, Richard Guenther wrote:
> >> On Tue, May 24, 2011 at 2:26 PM, William J. Schmidt
> >>  wrote:
> >> > Sure, I'll give that a try this morning.  Much obliged.
> >>
> >> Seems it won't work that way without some major changes elsewhere.
> >> Instead follow what update_call_from_tree () does before calling
> >> gsi_replace.
> >
> > Bother.  This won't work, unfortunately.  I can't use gimple_set_vuse ()
> > and gimple_set_vdef () on statements without memory ops.
> 
> You should do
> 
>   if (!gimple_has_mem_ops (new_stmt))
> unlink_stmt_vdef (old_stmt);

OK, thanks, that's the interface I was struggling to find.

That solved the issue I ran into.  The handling for powi now looks like
this:

CASE_FLT_FN (BUILT_IN_POWI):
  arg0 = gimple_call_arg (stmt, 0);
  arg1 = gimple_call_arg (stmt, 1);
  if (!host_integerp (arg1, 0))
break;

  n = TREE_INT_CST_LOW (arg1);
  loc = gimple_location (stmt);
  result = gimple_expand_builtin_powi (&gsi, loc, arg0, n);

  if (result)
{
  tree lhs = gimple_get_lhs (stmt);
  gimple new_stmt = gimple_build_assign (lhs, result);
  gimple_set_location (new_stmt, loc);
  move_ssa_defining_stmt_for_defs (new_stmt, stmt);

  if (gimple_vdef (stmt))
{
  gcc_assert (!gimple_has_mem_ops (new_stmt));
  unlink_stmt_vdef (stmt);
}

  gsi_replace (&gsi, new_stmt, true);
}
  break;

gimple_has_mem_ops (new_stmt) will always return false.  The assert is
in place in case we add other powi transforms in the future.

The call to move_ssa_defining_stmt_for_defs requires adding the header
file tree-ssa-propagate.h, and the corresponding dependency in
Makefile.in.

Currently regression testing the "final" fix.  Let me know if you want
to see it one more time before commit.

Thanks as always for your help!

Bill

> 
> > Bill
> >
> >>
> >> Richard.
> >>
> >
> >
> >



RFA PR 48770

2011-05-24 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


This has gone latent on the trunk, but the underlying issue hasn't been
resolved.

ira.c::update_equiv_regs can create REG_EQUIV notes for equivalences
which are local to a block rather than the traditional function-wide
equivalences we typically work with.

This occurs when we have an insn that loads a pseudo from a MEM and the
pseudo is used within only a single block and the MEM remains unchanged
through the life of the pseudo.

Starting with the assumption that we're going to create a block local
pseudo under the rules noted above, consider this RTL:

(set (reg X) (some address))
(set (reg Y) (mem (reg X)))
(use Y)


We're going to create an equivalence between (reg Y) and its memory
location in update_equiv_regs.  Assume IRA is able to allocate a hard
reg for reg X, but not reg Y.

reload's strategy in this situation will be to remove the insn which
creates the equivalence between reg Y and the memory location.  Uses of
reg Y will be replaced with the equivalent memory location.

That's all fine and good, except reload uses delete_dead_insn, which
deletes the equivalencing insn, but also recursively tries to remove the
prior insn if it becomes dead as a result of removing the equivalencing
insn.

Anyway, continuing with our example, reg X gets a hard reg, so our RTL
will look something like

(set (reg 0) (some address))
(set (reg Y) (mem (reg 0)))
(use Y)

Then we remove the equivalencing insn resulting in

(set (reg 0) (some address)
(use Y)

And we recurse from delete_dead_insn and determine that the first insn
was dead as well, so it gets removed leaving:

(use Y)

We then replace Y with its equivalent memory location

(use (mem (reg 0))

At which point we lose because hard reg 0 is no longer initialized.


The code in question is literally 20 years old and predates running any
real dead code elimination after reload.  ISTM the right thing to do is
stop using delete_dead_insn in this code and let the post-reload DCE
pass do its job.  That allows us to continue to record the block local
equivalence.

Bootstrapped and regression tested on x86_64-unknown-linux-gnu.
Testcase is included, even though the bug has gone latent on the trunk.

OK?


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

iQEcBAEBAgAGBQJN28/5AAoJEBRtltQi2kC79hAH/13usH0o6sNusDXHfuNgfFfu
+qpQpXo9P1UdyOoSU8pycb4IkR8Wi675xpwQw0pgMG7EVZ6AbE+FvhEO5Czu8OJz
1QBfNxCkWgNCDjt7SG4YqNBsk1HBs2BjTxFv66DkhquslxYZrftWSgoGcywAU6Qn
5eaRaOfk2hLQ52fm+X3MrWrLUjIf+Tg2HFegwCNHNRvTtpeKFm5RBjJcdpn1PWcF
1Hb8vjlkMK8ttYF1uySKm+q8q5wxlq6hBAWfiBtMZz2KFL6+Vr+Y9LfvH/4eE9e9
ZGx/2bqTsxFYCE6PSPA+7rIcNKzFHLSAAA0CfVy9fk7p9vnXJL8VE+8F0A5Pj8o=
=fYFt
-END PGP SIGNATURE-
PR middle-end/48770
* ira.c (update_equiv_regs): Update comment.
* reload1.c (reload): Don't call delete_dead_insn to delete
insns which create equivalences.

PR middle-end/48770
* gcc.dg/pr48770.c: New test.

Index: testsuite/gcc.dg/pr48770.c
===
*** testsuite/gcc.dg/pr48770.c  (revision 0)
--- testsuite/gcc.dg/pr48770.c  (revision 0)
***
*** 0 
--- 1,21 
+ /* { dg-do run } */
+ /* { dg-options "-O -fprofile-arcs -fPIC -fno-dce -fno-forward-propagate" } */
+ 
+ int test_goto2 (int f)
+ {
+   int i;
+   for (i = 0; ({_Bool a = i < 10;a;}); i++)
+   {
+ if (i == f)
+   goto lab2;
+   }
+   return 4;
+ lab2:
+   return 8;
+ }
+ 
+ int main ()
+ {
+   test_goto2 (30);
+   return 0;
+ }
Index: ira.c
===
*** ira.c   (revision 174066)
--- ira.c   (working copy)
*** update_equiv_regs (void)
*** 2842,2848 
 If we don't have a REG_EQUIV note, see if this insn is loading
 a register used only in one basic block from a MEM.  If so, and the
 MEM remains unchanged for the life of the register, add a REG_EQUIV
!note.  */
  
  note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
  
--- 2842,2848 
 If we don't have a REG_EQUIV note, see if this insn is loading
 a register used only in one basic block from a MEM.  If so, and the
 MEM remains unchanged for the life of the register, add a REG_EQUIV
!note, this creates a block local equivalence.  */
  
  note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
  
Index: reload1.c
===
*** reload1.c   (revision 174086)
--- reload1.c   (working copy)
*** reload (rtx first, int global)
*** 1011,1021 
mark_elimination (ep->from, ep->to);
  
/* If a pseudo has no hard reg, delete the insns that made the equivalence.
!  If that insn didn't set the register (i.e., it copied the register to
!  memory), just delete that insn in

Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld

2011-05-24 Thread Rainer Orth
Uros Bizjak  writes:

>> I think I tried something along these lines, but failed with duplicate
>> @plt@plt for PIC code.
>
> Hm, there is no %P1 present, so I don't think this should be an issue.

Unfortunately, I do get assembler errors (Sun as at the moment) with
your updated patch:

libtool: compile:  /var/gcc/gcc-4.7.0-20110523/10-gcc/./gcc/xgcc -shared-libgcc 
-B/var/gcc/gcc-4.7.0-20110523/10-gcc/./gcc -nostdinc++ 
-L/var/gcc/gcc-4.7.0-20110523/10-gcc/i386-pc-solaris2.10/amd64/libstdc++-v3/src 
-L/var/gcc/gcc-4.7.0-20110523/10-gcc/i386-pc-solaris2.10/amd64/libstdc++-v3/src/.libs
 -B/usr/local/i386-pc-solaris2.10/bin/ -B/usr/local/i386-pc-solaris2.10/lib/ 
-isystem /usr/local/i386-pc-solaris2.10/include -isystem 
/usr/local/i386-pc-solaris2.10/sys-include -m64 
-I/vol/gcc/src/hg/trunk/solaris/libstdc++-v3/../gcc 
-I/var/gcc/gcc-4.7.0-20110523/10-gcc/i386-pc-solaris2.10/amd64/libstdc++-v3/include/i386-pc-solaris2.10
 
-I/var/gcc/gcc-4.7.0-20110523/10-gcc/i386-pc-solaris2.10/amd64/libstdc++-v3/include
 -I/vol/gcc/src/hg/trunk/solaris/libstdc++-v3/libsupc++ -fno-implicit-templates 
-Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once 
-ffunction-sections -fdata-sections -g -O2 -m64 -c 
/vol/gcc/src/hg/trunk/solaris/libstdc++-v3/libsupc++/fundamental_type_info.cc  
-fPIC -DPIC -o funinfo.o
damental_type_info.o
Assembler: eh_globals.cc
"/var/tmp//ccJ1MA8h.s", line 17 : Syntax error
Near line: "call__tls_get_addr(%rip)@plt"
"/var/tmp//ccJ1MA8h.s", line 38 : Syntax error
Near line: "call__tls_get_addr(%rip)@plt"
make[9]: *** [eh_globals.lo] Error 1

Which makes me wonder if I should run the gcc.dg/torture/tls-*.c tests
with -fPIC, too.

>>> is IIRC preferred by Sun assebler.
>>
>> I've never seen such an issue.
>
> OK, it is your call... please change @plt to @PLT if desired.

I'll keep it at @plt for consistency with the rest.

Thanks.
Rainer

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


Re: [Fwd: Re: [PATCH] Add powi-to-multiply expansion to cse_sincos pass]

2011-05-24 Thread Richard Guenther
On Tue, May 24, 2011 at 5:28 PM, William J. Schmidt
 wrote:
>
> On Tue, 2011-05-24 at 16:44 +0200, Richard Guenther wrote:
>> On Tue, May 24, 2011 at 3:38 PM, William J. Schmidt
>>  wrote:
>> >
>> > On Tue, 2011-05-24 at 15:11 +0200, Richard Guenther wrote:
>> >> On Tue, May 24, 2011 at 2:26 PM, William J. Schmidt
>> >>  wrote:
>> >> > Sure, I'll give that a try this morning.  Much obliged.
>> >>
>> >> Seems it won't work that way without some major changes elsewhere.
>> >> Instead follow what update_call_from_tree () does before calling
>> >> gsi_replace.
>> >
>> > Bother.  This won't work, unfortunately.  I can't use gimple_set_vuse ()
>> > and gimple_set_vdef () on statements without memory ops.
>>
>> You should do
>>
>>   if (!gimple_has_mem_ops (new_stmt))
>>     unlink_stmt_vdef (old_stmt);
>
> OK, thanks, that's the interface I was struggling to find.
>
> That solved the issue I ran into.  The handling for powi now looks like
> this:
>
>                CASE_FLT_FN (BUILT_IN_POWI):
>                  arg0 = gimple_call_arg (stmt, 0);
>                  arg1 = gimple_call_arg (stmt, 1);
>                  if (!host_integerp (arg1, 0))
>                    break;
>
>                  n = TREE_INT_CST_LOW (arg1);
>                  loc = gimple_location (stmt);
>                  result = gimple_expand_builtin_powi (&gsi, loc, arg0, n);
>
>                  if (result)
>                    {
>                      tree lhs = gimple_get_lhs (stmt);
>                      gimple new_stmt = gimple_build_assign (lhs, result);
>                      gimple_set_location (new_stmt, loc);
>                      move_ssa_defining_stmt_for_defs (new_stmt, stmt);
>
>                      if (gimple_vdef (stmt))
>                        {
>                          gcc_assert (!gimple_has_mem_ops (new_stmt));
>                          unlink_stmt_vdef (stmt);
>                        }

As you say the new stmt will not have mem-ops, so
move_ssa_defining_stmt_for_defs is not necessary.  Likewise
you can simply unconditionally call unlink_stmt_vdef.

>                      gsi_replace (&gsi, new_stmt, true);
>                    }
>                  break;
>
> gimple_has_mem_ops (new_stmt) will always return false.  The assert is
> in place in case we add other powi transforms in the future.
>
> The call to move_ssa_defining_stmt_for_defs requires adding the header
> file tree-ssa-propagate.h, and the corresponding dependency in
> Makefile.in.
>
> Currently regression testing the "final" fix.  Let me know if you want
> to see it one more time before commit.

It's ok with the above two changes.

Thanks,
Richard.

> Thanks as always for your help!
>
> Bill
>
>>
>> > Bill
>> >
>> >>
>> >> Richard.
>> >>
>> >
>> >
>> >
>
>


PATCH: PR target/49142: Invalid 8bit register operand

2011-05-24 Thread H.J. Lu
Hi,

We are working on a new optimization, which turns off TARGET_MOVX.
GCC generates:

movb %ah, %dil

But %ah can only be used with %[abcd][hl].  This patch adds QIreg_operand
and uses it in *movqi_extv_1_rex64/*movqi_extzv_2_rex64.  OK for trunk
if there is no regression?

Thanks.


H.J.
---
2011-05-24  H.J. Lu  

PR target/49142
* config/i386/i386.md (*movqi_extv_1_rex64): Replace
q_regs_operand with QIreg_operand.
(*movqi_extzv_2_rex64): Likewise.

* config/i386/predicates.md (QIreg_operand): New.

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 6c158cf..b7f5866 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2635,7 +2635,7 @@
 }
   [(set (attr "type")
  (if_then_else (and (match_operand:QI 0 "register_operand" "")
-   (ior (not (match_operand:QI 0 "q_regs_operand" ""))
+   (ior (not (match_operand:QI 0 "QIreg_operand" ""))
 (ne (symbol_ref "TARGET_MOVX")
 (const_int 0
(const_string "imovx")
@@ -2699,7 +2699,7 @@
 }
 }
   [(set (attr "type")
- (if_then_else (ior (not (match_operand:QI 0 "q_regs_operand" ""))
+ (if_then_else (ior (not (match_operand:QI 0 "QIreg_operand" ""))
(ne (symbol_ref "TARGET_MOVX")
(const_int 0)))
(const_string "imovx")
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 8a89f70..1471f5a 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -82,6 +82,10 @@
   (and (match_code "reg")
(match_test "REGNO (op) == FLAGS_REG")))
 
+;; Return true if op is one of QImode registers: %[abcd][hl].
+(define_predicate "QIreg_operand"
+  (match_test "QI_REG_P (op)"))
+
 ;; Return true if op is a QImode register operand other than
 ;; %[abcd][hl].
 (define_predicate "ext_QIreg_operand"


Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld

2011-05-24 Thread Joseph S. Myers
On Tue, 24 May 2011, Rainer Orth wrote:

> Which makes me wonder if I should run the gcc.dg/torture/tls-*.c tests
> with -fPIC, too.

I think it makes sense to try to provide reasonable coverage of TLS tests 
with all of -fPIC, -fpic, -fPIE and -fpie.

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


Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld

2011-05-24 Thread Uros Bizjak
On Tue, May 24, 2011 at 5:34 PM, Rainer Orth
 wrote:
> Uros Bizjak  writes:
>
>>> I think I tried something along these lines, but failed with duplicate
>>> @plt@plt for PIC code.
>>
>> Hm, there is no %P1 present, so I don't think this should be an issue.
>
> Unfortunately, I do get assembler errors (Sun as at the moment) with
> your updated patch:
>
> libtool: compile:  /var/gcc/gcc-4.7.0-20110523/10-gcc/./gcc/xgcc 
> -shared-libgcc -B/var/gcc/gcc-4.7.0-20110523/10-gcc/./gcc -nostdinc++ 
> -L/var/gcc/gcc-4.7.0-20110523/10-gcc/i386-pc-solaris2.10/amd64/libstdc++-v3/src
>  
> -L/var/gcc/gcc-4.7.0-20110523/10-gcc/i386-pc-solaris2.10/amd64/libstdc++-v3/src/.libs
>  -B/usr/local/i386-pc-solaris2.10/bin/ -B/usr/local/i386-pc-solaris2.10/lib/ 
> -isystem /usr/local/i386-pc-solaris2.10/include -isystem 
> /usr/local/i386-pc-solaris2.10/sys-include -m64 
> -I/vol/gcc/src/hg/trunk/solaris/libstdc++-v3/../gcc 
> -I/var/gcc/gcc-4.7.0-20110523/10-gcc/i386-pc-solaris2.10/amd64/libstdc++-v3/include/i386-pc-solaris2.10
>  
> -I/var/gcc/gcc-4.7.0-20110523/10-gcc/i386-pc-solaris2.10/amd64/libstdc++-v3/include
>  -I/vol/gcc/src/hg/trunk/solaris/libstdc++-v3/libsupc++ 
> -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual 
> -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -O2 
> -m64 -c 
> /vol/gcc/src/hg/trunk/solaris/libstdc++-v3/libsupc++/fundamental_type_info.cc 
>  -fPIC -DPIC -o funinfo.o
> damental_type_info.o
> Assembler: eh_globals.cc
>        "/var/tmp//ccJ1MA8h.s", line 17 : Syntax error
>        Near line: "    call    __tls_get_addr(%rip)@plt"
>        "/var/tmp//ccJ1MA8h.s", line 38 : Syntax error
>        Near line: "    call    __tls_get_addr(%rip)@plt"
> make[9]: *** [eh_globals.lo] Error 1

Bah. %P has a special handling that removes (%rip). Are you sure Sun
assembler requests @plt in PIC and non-PIC cases? Can we solve this
with TARGET_SUN_TLS somehow?

Thanks,
Uros.


Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld

2011-05-24 Thread Rainer Orth
Uros Bizjak  writes:

>> Assembler: eh_globals.cc
>>        "/var/tmp//ccJ1MA8h.s", line 17 : Syntax error
>>        Near line: "    call    __tls_get_addr(%rip)@plt"
>>        "/var/tmp//ccJ1MA8h.s", line 38 : Syntax error
>>        Near line: "    call    __tls_get_addr(%rip)@plt"
>> make[9]: *** [eh_globals.lo] Error 1
>
> Bah. %P has a special handling that removes (%rip). Are you sure Sun
> assembler requests @plt in PIC and non-PIC cases? Can we solve this

Pretty much so: my first attempts to resolve this consisted in taking
the regular gcc assembler output and mangling it until it worked with ld.

> with TARGET_SUN_TLS somehow?

We could certainly duplicate (some of) the logic that %P already uses,
but I though it easier to just introduce a straightforward variant (%p)
instead.  It's not pretty, but it worked.

Rainer

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


Re: [patch][simplify-rtx] Fix 16-bit -> 64-bit multiply and accumulate

2011-05-24 Thread Andrew Stubbs

On 03/05/11 10:07, Bernd Schmidt wrote:

I tried to fix it with the patch below, which unfortunately doesn't work
since during combine we don't see the SIGN_EXTEND operations inside the
MULT, but two shift operations instead. Maybe you can complete it from here?


I've tried to make this patch go various ways, and I always find a test 
case that doesn't quite work. I think we're approaching it from the 
wrong angle.


The problem is that widening multiplies are required to be defined as 
(mult (extend ..) (extend ..)), but when the combiner tries to build a 
widening multiply pattern from a regular multiply it naturally ends up 
as (extend (mult .. ..)). The result is that the patch Benrd posted made 
existing widening multiplies wider, but failed to convert regular 
multiplies to widening ones.


I've created this new, simpler patch that converts

  (extend (mult a b))

into

  (mult (extend a) (extend b))

regardless of what 'a' and 'b' might be. (These are then simplified and 
superfluous extends removed, of course.)


I find that this patch fixes all the testcases I have, and permitted me 
to add support for ARM smlalbt/smlaltb/smlaltt also (I'll post that in a 
separate patch).


It does assume that the outer sign_extend/zero_extend indicates the 
inner extend types though, so I'm not sure if there's a problem there?


OK?

Andrew
2011-05-24  Bernd Schmidt  
	Andrew Stubbs  

	gcc/
	* simplify-rtx.c (simplify_unary_operation_1): Create a new
	canonical form for widening multiplies.
	* doc/md.texi (Canonicalization of Instructions): Document widening
	multiply canonicalization.

	gcc/testsuite/
	* gcc.target/arm/mla-2.c: New test.

--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -5840,6 +5840,11 @@ Equality comparisons of a group of bits (usually a single bit) with zero
 will be written using @code{zero_extract} rather than the equivalent
 @code{and} or @code{sign_extract} operations.
 
+@cindex @code{mult}, canonicalization of
+@item
+@code{(sign_extend:@var{m1} (mult:@var{m2} @var{x} @var{y}))} is converted
+to @code{(mult:@var{m1} (sign_extend:@var{m1} @var{x}) (sign_extend:@var{m1} @var{y}))}, and likewise for @code{zero_extract}.
+
 @end itemize
 
 Further canonicalization rules are defined in the function
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1000,6 +1000,21 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
 	  && GET_CODE (XEXP (XEXP (op, 0), 1)) == LABEL_REF)
 	return XEXP (op, 0);
 
+  /* Convert (sign_extend (mult ..)) to a canonical widening
+	 mulitplication (mult (sign_extend ..) (sign_extend ..)).  */
+  if (GET_CODE (op) == MULT && GET_MODE (op) < mode)
+	{
+	  rtx lhs = XEXP (op, 0);
+	  rtx rhs = XEXP (op, 1);
+	  enum machine_mode lhs_mode = GET_MODE (lhs);
+	  enum machine_mode rhs_mode = GET_MODE (rhs);
+	  return simplify_gen_binary (MULT, mode,
+  simplify_gen_unary (SIGN_EXTEND, mode,
+			  lhs, lhs_mode),
+  simplify_gen_unary (SIGN_EXTEND, mode,
+			  rhs, rhs_mode));
+	}
+
   /* Check for a sign extension of a subreg of a promoted
 	 variable, where the promotion is sign-extended, and the
 	 target mode is the same as the variable's promotion.  */
@@ -1071,6 +1086,21 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
 	  && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (XEXP (op, 0
 	return rtl_hooks.gen_lowpart_no_emit (mode, op);
 
+  /* Convert (zero_extend (mult ..)) to a canonical widening
+	 mulitplication (mult (zero_extend ..) (zero_extend ..)).  */
+  if (GET_CODE (op) == MULT && GET_MODE (op) < mode)
+	{
+	  rtx lhs = XEXP (op, 0);
+	  rtx rhs = XEXP (op, 1);
+	  enum machine_mode lhs_mode = GET_MODE (lhs);
+	  enum machine_mode rhs_mode = GET_MODE (rhs);
+	  return simplify_gen_binary (MULT, mode,
+  simplify_gen_unary (ZERO_EXTEND, mode,
+			  lhs, lhs_mode),
+  simplify_gen_unary (ZERO_EXTEND, mode,
+			  rhs, rhs_mode));
+	}
+
   /* (zero_extend:M (zero_extend:N )) is (zero_extend:M ).  */
   if (GET_CODE (op) == ZERO_EXTEND)
 	return simplify_gen_unary (ZERO_EXTEND, mode, XEXP (op, 0),
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mla-2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=armv7-a" } */
+
+long long foolong (long long x, short *a, short *b)
+{
+return x + *a * *b;
+}
+
+/* { dg-final { scan-assembler "smlalbb" } } */


Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld

2011-05-24 Thread Uros Bizjak
On Tue, May 24, 2011 at 6:42 PM, Rainer Orth
 wrote:
> Uros Bizjak  writes:
>
>>> Assembler: eh_globals.cc
>>>        "/var/tmp//ccJ1MA8h.s", line 17 : Syntax error
>>>        Near line: "    call    __tls_get_addr(%rip)@plt"
>>>        "/var/tmp//ccJ1MA8h.s", line 38 : Syntax error
>>>        Near line: "    call    __tls_get_addr(%rip)@plt"
>>> make[9]: *** [eh_globals.lo] Error 1
>>
>> Bah. %P has a special handling that removes (%rip). Are you sure Sun
>> assembler requests @plt in PIC and non-PIC cases? Can we solve this
>
> Pretty much so: my first attempts to resolve this consisted in taking
> the regular gcc assembler output and mangling it until it worked with ld.
>
>> with TARGET_SUN_TLS somehow?
>
> We could certainly duplicate (some of) the logic that %P already uses,
> but I though it easier to just introduce a straightforward variant (%p)
> instead.  It's not pretty, but it worked.

OK then... can you propose a new patch, please, changing as little of
generic code as possible?

Uros.


Patch fixing PR objc/48187

2011-05-24 Thread Nicola Pero
This routine patch fixes PR objc/48187.  The problem is that the following code

@interface A
{
  ]
}
@end

would cause the ObjC parser to enter into an infinite loop.  The parser
fails to parse ] as an instance variable, but then when it tries to skip
to the next semicolon to resume parsing from the next instance variable,
the standard c_parser_skip_until_found() doesn't skip the ] because it's
a special token that reduces the nesting level.  So, the parser tries to
parse ] again as an instance variable, and then again and again, failing
to ever make any progress ;-)

The fix adds an explicit branch to deal with the parsing failure, and carefully
skips to the next semicolon (or '}) even in the case of ']' or ')'.

--

As I was looking at that chunk of code, I also noticed the error message saying
"extra semicolon in struct or union specified" for an extra semicolon found in a
list of ObjC instance variables.  I think it's incorrect or at least confusing
as a list of ObjC instance variables isn't a "struct or union". ;-)

I changed it to simply say "extra semicolon" as I like short and clear error 
messages.
But I'm happy to change it to something else (eg, "extra semicolon specified in 
list
of Objective-C instance variables") if other people disagree.

--

I added testcases.

--

Finally, I also updated the ObjC++ parser so that it would survive the same 
testcases
(previously they would crash the compiler).

Ok to commit ?

Thanks

Index: ChangeLog
===
--- ChangeLog   (revision 174112)
+++ ChangeLog   (working copy)
@@ -1,3 +1,11 @@
+2011-05-24  Nicola Pero  
+
+   PR objc/48187
+   * c-parser.c (c_parser_objc_class_instance_variables): More robust
+   parsing of syntax error in ObjC instance variable lists.  In
+   particular, avoid an infinite loop if there is a stray ']'.
+   Updated error message.
+
 2011-05-24  Joseph Myers  
 
* Makefile.in (GCC_OBJS): Remove opts-common.o and options.o.
Index: testsuite/ChangeLog
===
--- testsuite/ChangeLog (revision 174112)
+++ testsuite/ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2011-05-24  Nicola Pero  
+
+   PR objc/48187
+   * objc.dg/pr48187.m: New testcase.
+   * obj-c++.dg/pr48187.mm: New testcase.
+   * objc.dg/ivar-extra-semicolon.m: New testcase.
+   
 2011-05-24  Tom de Vries  
 
PR tree-optimization/49121
Index: testsuite/objc.dg/ivar-extra-semicolon.m
===
--- testsuite/objc.dg/ivar-extra-semicolon.m(revision 0)
+++ testsuite/objc.dg/ivar-extra-semicolon.m(revision 0)
@@ -0,0 +1,15 @@
+/* Contributed by Nicola Pero , May 2011.  */
+/* { dg-do compile } */
+/* { dg-options "-pedantic" } */
+
+#include 
+
+@interface MyClass
+{
+  ;   /* { dg-warning "extra semicolon" } */
+  int a;  
+  ;   /* { dg-warning "extra semicolon" } */
+  int b;
+  ;   /* { dg-warning "extra semicolon" } */
+}
+@end
Index: testsuite/objc.dg/pr48187.m
===
--- testsuite/objc.dg/pr48187.m (revision 0)
+++ testsuite/objc.dg/pr48187.m (revision 0)
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+
+@interface A
+{
+  ]  /* { dg-error "xpected" } */
+}
+@end
+
+@interface B
+{
+  ];  /* { dg-error "xpected" } */
+}
+@end
+
+@interface C
+{
+  ];  /* { dg-error "xpected" } */
+  int x;
+}
+@end
+
+@interface D
+{
+  )  /* { dg-error "xpected" } */
+}
+@end
+
+@interface E
+{
+  );  /* { dg-error "xpected" } */
+}
+@end
+
+@interface F
+{
+  );  /* { dg-error "xpected" } */
+  int x;
+}
+@end
Index: testsuite/obj-c++.dg/pr48187.mm
===
--- testsuite/obj-c++.dg/pr48187.mm (revision 0)
+++ testsuite/obj-c++.dg/pr48187.mm (revision 0)
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+
+@interface A
+{
+  ]  /* { dg-error "xpected" } */
+}
+@end
+
+@interface B
+{
+  ];  /* { dg-error "xpected" } */
+}
+@end
+
+@interface C
+{
+  ];  /* { dg-error "xpected" } */
+  int x;
+}
+@end
+
+@interface D
+{
+  (
+}  /* { dg-error "xpected" } */
+@end
+
+@interface E
+{
+  (;  /* { dg-error "xpected" } */
+}
+@end
+
+@interface F
+{
+  (;  /* { dg-error "xpected" } */
+  int x;
+}
+@end
Index: cp/ChangeLog
===
--- cp/ChangeLog(revision 174112)
+++ cp/ChangeLog(working copy)
@@ -1,3 +1,8 @@
+2011-05-24  Nicola Pero  ,
+
+   * parser.c (cp_parser_objc_class_ivars): Deal gracefully with a
+   syntax error in declaring an ObjC instance variable.
+
 2011-05-24  Joseph Myers  
 
* Make-lang.in (GXX_OBJS): Remove prefix.o.
Index: cp/parser.c
===
--- cp/parser.c (revision 174112)
+++ cp/parser.c (working copy)
@@ -22494,7 +22494,8 @@ cp_parser_objc_class_ivars (cp_

Tiny documentation update in diagnostic.c

2011-05-24 Thread Nicola Pero
Ok to commit ?

Thanks

Index: ChangeLog
===
--- ChangeLog   (revision 174112)
+++ ChangeLog   (working copy)
@@ -1,3 +1,15 @@
+2011-05-24  Nicola Pero  
+
+   * diagnostic.c (pedwarn): Updated comment.
+
Index: diagnostic.c
===
--- diagnostic.c(revision 174112)
+++ diagnostic.c(working copy)
@@ -701,8 +701,9 @@
Note that these diagnostics are issued independent of the setting
of the -pedantic command-line switch.  To get a warning enabled
only with that switch, use either "if (pedantic) pedwarn
-   (OPT_pedantic,...)" or just "pedwarn (OPT_pedantic,..)".  To get a
-   pedwarn independently of the -pedantic switch use "pedwarn (0,...)".
+   (,OPT_pedantic,...)" or just "pedwarn (,OPT_pedantic,..)".  To get
+   a pedwarn independently of the -pedantic switch use "pedwarn
+   (,0,...)".
 
Returns true if the warning was printed, false if it was inhibited.  */
 




Re: PATCH: PR target/49128: -mtune=native generates unsupported instructions

2011-05-24 Thread Uros Bizjak
On Mon, May 23, 2011 at 8:25 PM, H.J. Lu  wrote:

>>> +      const char *sse4_2 = has_sse4_2 ? " -msse4.2" : " -msse4.2";
>>> +      const char *sse4_1 = has_sse4_1 ? " -msse4.1" : " -msse4.1";
>>
>> Missing "no-" here on both lines.
>>
>
> Here is the updated patch.  It also handles FMA.  OK for trunk and 4.6
> if there are no regressions?
>
>
> --
> H.J.
> 
> 2011-05-23  H.J. Lu  
>
>        PR target/49128
>        * config/i386/driver-i386.c (host_detect_local_cpu): Always
>        add -mno-XXX.  Handle FMA.

OK.

Thanks,
Uros.


Re: RFA (libstdc++): C++/v3 PATCH for c++/24163 (lookup in dependent bases) and c++/29131

2011-05-24 Thread Jason Merrill

OK.

Jason


Re: [PING][PATCH 13/18] move TS_EXP to be a substructure of TS_TYPED

2011-05-24 Thread Nathan Froyd
`0On Mon, May 23, 2011 at 04:58:06PM +0200, Richard Guenther wrote:
> On Mon, May 23, 2011 at 4:18 PM, Nathan Froyd  
> wrote:
> > On 05/17/2011 11:31 AM, Nathan Froyd wrote:
> >> On 05/10/2011 04:18 PM, Nathan Froyd wrote:
> >>> On 03/10/2011 11:23 PM, Nathan Froyd wrote:
>  After all that, we can finally make tree_exp inherit from typed_tree.
>  Quite anticlimatic.
> >>>
> >>> Ping.  http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00559.html
> >>
> >> Ping^2.
> >
> > Ping^3 to put it in Richi's INBOX. ;)
> 
> Ok ;)
>
> Please check for sizeof () uses of the structs you touched sofar.
> ISTR a bug about fold-checking.

That doesn't apply here, because I'm not renaming the struct.  But I did
find some problems with LTO when I was rebootstrapping prior to
committing; not sure how I missed these the first time through, maybe I
was mistakenly compiling without LTO support.  Since we now have things
being dumped to LTO that don't have TREE_CHAIN, we need to take care to
not access TREE_CHAIN on such things, which the patch below does.

Tested on x86_64-unknown-linux-gnu.  OK to commit?

-Nathan

gcc/
* tree.h (struct tree_exp): Inherit from struct tree_typed.
* tree.c (initialize_tree_contains_struct): Mark TS_EXP as TS_TYPED
instead of TS_COMMON.

gcc/lto/
* lto.c (lto_ft_typed): New function.
(lto_ft_common): Call it.
(lto_ft_constructor): Likewise.
(lto_ft_expr): Likewise.
(lto_fixup_prevailing_decls): Check for TS_COMMON before accessing
TREE_CHAIN.

diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index d64ba18..1067b51 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -254,14 +254,20 @@ remember_with_vars (tree t)
 
 static void lto_fixup_types (tree);
 
-/* Fix up fields of a tree_common T.  */
+/* Fix up fields of a tree_typed T.  */
 
 static void
-lto_ft_common (tree t)
+lto_ft_typed (tree t)
 {
-  /* Fixup our type.  */
   LTO_FIXUP_TREE (TREE_TYPE (t));
+}
+
+/* Fix up fields of a tree_common T.  */
 
+static void
+lto_ft_common (tree t)
+{
+  lto_ft_typed (t);
   LTO_FIXUP_TREE (TREE_CHAIN (t));
 }
 
@@ -398,7 +404,7 @@ lto_ft_constructor (tree t)
   unsigned HOST_WIDE_INT idx;
   constructor_elt *ce;
 
-  LTO_FIXUP_TREE (TREE_TYPE (t));
+  lto_ft_typed (t);
 
   for (idx = 0;
VEC_iterate(constructor_elt, CONSTRUCTOR_ELTS (t), idx, ce);
@@ -415,7 +421,7 @@ static void
 lto_ft_expr (tree t)
 {
   int i;
-  lto_ft_common (t);
+  lto_ft_typed (t);
   for (i = TREE_OPERAND_LENGTH (t) - 1; i >= 0; --i)
 LTO_FIXUP_TREE (TREE_OPERAND (t, i));
 }
@@ -2029,7 +2035,8 @@ lto_fixup_prevailing_decls (tree t)
 {
   enum tree_code code = TREE_CODE (t);
   LTO_NO_PREVAIL (TREE_TYPE (t));
-  LTO_NO_PREVAIL (TREE_CHAIN (t));
+  if (CODE_CONTAINS_STRUCT (code, TS_COMMON))
+LTO_NO_PREVAIL (TREE_CHAIN (t));
   if (DECL_P (t))
 {
   LTO_NO_PREVAIL (DECL_NAME (t));
diff --git a/gcc/tree.c b/gcc/tree.c
index 3357d84..9cc99fe 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -380,6 +380,7 @@ initialize_tree_contains_struct (void)
case TS_COMPLEX:
case TS_SSA_NAME:
case TS_CONSTRUCTOR:
+   case TS_EXP:
  MARK_TS_TYPED (code);
  break;
 
@@ -388,7 +389,6 @@ initialize_tree_contains_struct (void)
case TS_TYPE_COMMON:
case TS_LIST:
case TS_VEC:
-   case TS_EXP:
case TS_BLOCK:
case TS_BINFO:
case TS_STATEMENT_LIST:
diff --git a/gcc/tree.h b/gcc/tree.h
index 805fe06..142237f 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1917,7 +1917,7 @@ enum omp_clause_default_kind
   (OMP_CLAUSE_SUBCODE_CHECK (NODE, 
OMP_CLAUSE_DEFAULT)->omp_clause.subcode.default_kind)
 
 struct GTY(()) tree_exp {
-  struct tree_common common;
+  struct tree_typed typed;
   location_t locus;
   tree block;
   tree GTY ((special ("tree_exp"),


[testsuite] update error message in arm test

2011-05-24 Thread Janis Johnson
The error message for unknown types changed a few months ago.  Update
a test that still looks for the old message.

Tested on arm-none-linux-gnueabi.  OK for trunk and 4.6?
2011-05-24  Janis Johnson  

* gcc.target/arm/fp16-compile-none-1.c: Update expected error.

Index: gcc.target/arm/fp16-compile-none-1.c
===
--- gcc.target/arm/fp16-compile-none-1.c(revision 174094)
+++ gcc.target/arm/fp16-compile-none-1.c(working copy)
@@ -3,4 +3,4 @@
 
 /* __fp16 type name is not recognized unless you explicitly enable it
by selecting -mfp16-format=ieee or -mfp16-format=alternative.  */
-__fp16 xx = 0.0;  /* { dg-error "expected" } */
+__fp16 xx = 0.0;  /* { dg-error "unknown type name" } */


[testsuite] ignore irrelevant warning in g++.dg/abi/packed1.C

2011-05-24 Thread Janis Johnson
Test g++.dg/abi/packed1.C triggers a warning for several targets.  That
warning is not relevant to the purpose of the test, as shown by the fact
that the dg-warning directive was added later and additional targets
keep trickling in.  Rather than continue to add to the list of targets
for the warning, this patch ignores the warning when it appears.

Tested on arm-none-linux-gnueabi.  OK for trunk and 4.6?
2011-05-24  Janis Johnson  

* g++.dg/abi/packed1.C: Ignore warning.

Index: g++.dg/abi/packed1.C
===
--- g++.dg/abi/packed1.C(revision 174094)
+++ g++.dg/abi/packed1.C(working copy)
@@ -1,10 +1,12 @@
 // PR c++/41788
 // { dg-options "-Wpacked" }
 // { dg-do run }
+// Ignore a warning that is irrelevant to the purpose of this test.
+// { dg-prune-output "inefficient.*vptr" }
 
 extern "C" void abort ();
 
-struct INNER { // { dg-warning "inefficient.*vptr" "" { target alpha*-*-* 
ia64-*-* hppa*-*-* mips-sgi-irix* sparc*-*-* spu-*-* sh*-*-* } }
+struct INNER {
   virtual int foo() const { return 1; }
 } __attribute__ ((packed));
 


[testsuite] ignore irrelevant warning in two ARM tests

2011-05-24 Thread Janis Johnson
On ARM, two g++ tests trigger a warning about changed mangling.  The
warning is not relevant to the purpose of the test, so this patch
causes it to be ignored.

Tested on arm-none-linux-gnueabi.  OK for trunk and 4.6?
2011-05-24  Janis Johnson  

* g++.dg/template/stdarg1.C: Ignore warning.
* g++.dg/warn/Wunused-parm-3.C: Likewise.

Index: g++.dg/template/stdarg1.C
===
--- g++.dg/template/stdarg1.C   (revision 174094)
+++ g++.dg/template/stdarg1.C   (working copy)
@@ -1,5 +1,7 @@
 // PR c++/47022
 // { dg-do compile }
+// Ignore a warning that is irrelevant to the purpose of this test.
+// { dg-prune-output "mangling.*has changed" }
 
 #include 
 
Index: g++.dg/warn/Wunused-parm-3.C
===
--- g++.dg/warn/Wunused-parm-3.C(revision 174094)
+++ g++.dg/warn/Wunused-parm-3.C(working copy)
@@ -1,5 +1,7 @@
 // { dg-do compile }
 // { dg-options "-Wunused -W" }
+// Ignore a warning that is irrelevant to the purpose of this test.
+// { dg-prune-output "mangling.*has changed" }
 
 #include 
 


[build] Only build mips-tfile, mips-tdump native (PR target/3746)

2011-05-24 Thread Rainer Orth
There's a long-standing PR that mips-tfile and mips-tdump fail to
compile in a cross.  This happens because both refer to non-existant
mips/a.out.h files in the cross-compilation case.  Since the tools are
now only used on Tru64 UNIX and gas/gld don't work for that target,
there's no point in trying to build them.  Besides, if gas worked,
mips-tfile wouldn't be needed at all.

The following patch only enables them native, and removes cross support
from mips-tfile.c/mips-tdump.c.

Bootstrapped without regressions on alpha-dec-osf5.1b and verified that
a i386-pc-solaris2.10 x alpha-dec-osf5.1b only dies when trying to build
libgcc due to lack of assembler and target headers.

Installed on mainline.

Rainer


2011-05-20  Rainer Orth  

PR target/3746
* config.gcc (alpha*-dec-osf5.1*): Only build mips-tfile,
mips-tdump native.
* mips-tfile.c: Remove CROSS_DIRECTORY_STRUCTURE handling.
* mips-tdump.c: Likewise.

diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -748,7 +748,9 @@ alpha*-dec-osf5.1*)
then
tm_file="${tm_file} dbx.h"
fi
-   if test x$gas != xyes
+   # mips-tfile and mips-tdump are only used with the native assembler
+   # and require the Tru64 UNIX , so only build native.
+   if test x$gas != xyes && test x${host} = x${target}
then
extra_passes="mips-tfile mips-tdump"
fi
diff --git a/gcc/mips-tdump.c b/gcc/mips-tdump.c
--- a/gcc/mips-tdump.c
+++ b/gcc/mips-tdump.c
@@ -26,11 +26,7 @@ along with GCC; see the file COPYING3.  
 #ifdef index
 #undef index
 #endif
-#ifndef CROSS_DIRECTORY_STRUCTURE
 #include 
-#else
-#include "mips/a.out.h"
-#endif /* CROSS_DIRECTORY_STRUCTURE */
 
 /* Include getopt.h for the sake of getopt_long.  */
 #include "getopt.h"
diff --git a/gcc/mips-tfile.c b/gcc/mips-tfile.c
--- a/gcc/mips-tfile.c
+++ b/gcc/mips-tfile.c
@@ -1,4 +1,4 @@
-/* Update the symbol table (the .T file) in a MIPS object to
+/* Update the symbol table (the .T file) in a ECOFF object to
contain debugging information specified by the GNU compiler
in the form of comments (the mips assembler does not support
assembly access to debug information).
@@ -633,12 +633,7 @@ extern void error (const char *format, .
 
 #undef index
 
-#ifndef CROSS_DIRECTORY_STRUCTURE
 #include 
-#else
-#include "mips/a.out.h"
-#endif /* CROSS_DIRECTORY_STRUCTURE */
-
 #include "gstab.h"
 
 #define IS_ASM_IDENT(ch) \


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


Re: [google] Disable getpagesize() for Android toolchain (issue4515131)

2011-05-24 Thread 關振德
Shouldn't we test

ifndef __ANDROID__

instead?

-Doug

On Tue, May 24, 2011 at 2:39 AM, Guozhi Wei  wrote:
> Hi
>
> This patch is for google/main.
>
> In order to be compatible with current bionic and sysroot, we need to disable
> getpagesize(). After getpagesize() in bionic is changed and ndk contains that
> change, we can reenable it.
>
> Jing can give more details about it.
>
> This patch has been tested on arm qemu without regression.
>
> thanks
> Carrot
>
> 2011-05-24  Jing Yu  
>
>        * ChangeLog.google-main: New file.
>        * getpagesize.c(getpagesize): Disable it for bionic.
>
>
> Index: ChangeLog.google-main
> ===
> --- ChangeLog.google-main       (revision 0)
> +++ ChangeLog.google-main       (revision 0)
> @@ -0,0 +1,5 @@
> +Copyright (C) 2011 Free Software Foundation, Inc.
> +
> +Copying and distribution of this file, with or without modification,
> +are permitted in any medium without royalty provided the copyright
> +notice and this notice are preserved.
> Index: getpagesize.c
> ===
> --- getpagesize.c       (revision 174099)
> +++ getpagesize.c       (working copy)
> @@ -60,11 +60,13 @@ BUGS
>  # endif /* PAGESIZE */
>  #endif /* GNU_OUR_PAGESIZE */
>
> +#if DEFAULT_LIBC != LIBC_BIONIC
>  int
>  getpagesize (void)
>  {
>   return (GNU_OUR_PAGESIZE);
>  }
> +#endif
>
>  #else /* VMS */
>
>
> --
> This patch is available for review at http://codereview.appspot.com/4515131
>


PATCH: Add pause intrinsic

2011-05-24 Thread H.J. Lu
Hi,

This patch implements pause intrinsic suggested by Andi.  OK
for trunk?

Thanks.


-- 
H.J.
---
gcc/

2011-05-24  H.J. Lu  

* config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_PAUSE.
(bdesc_special_args): Add pause intrinsic.

* config/i386/i386.md (UNSPEC_PAUSE): New.
(pause): Likewise.
(*pause): Likewise.
* config/i386/ia32intrin.h (__pause): Likewise.

* doc/extend.texi (X86 Built-in Functions): Add documentation for
pause intrinsic.

gcc/testsuite/

2011-05-24  H.J. Lu  

 * gcc.target/i386/pause-1.c: New.
gcc/

2011-05-24  H.J. Lu  

	* config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_PAUSE.
	(bdesc_special_args): Add pause intrinsic.

	* config/i386/i386.md (UNSPEC_PAUSE): New.
	(pause): Likewise.
	(*pause): Likewise.
	* config/i386/ia32intrin.h (__pause): Likewise.

	* doc/extend.texi (X86 Built-in Functions): Add documentation for
	pause intrinsic.

gcc/testsuite/

2011-05-24  H.J. Lu  

	 * gcc.target/i386/pause-1.c: New.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 854e376..174caa0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -23912,6 +23912,7 @@ enum ix86_builtins
   IX86_BUILTIN_CLFLUSH,
   IX86_BUILTIN_MFENCE,
   IX86_BUILTIN_LFENCE,
+  IX86_BUILTIN_PAUSE,
 
   IX86_BUILTIN_BSRSI,
   IX86_BUILTIN_BSRDI,
@@ -24664,6 +24665,7 @@ static const struct builtin_description bdesc_special_args[] =
 {
   { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rdtsc, "__builtin_ia32_rdtsc", IX86_BUILTIN_RDTSC, UNKNOWN, (int) UINT64_FTYPE_VOID },
   { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rdtscp, "__builtin_ia32_rdtscp", IX86_BUILTIN_RDTSCP, UNKNOWN, (int) UINT64_FTYPE_PUNSIGNED },
+  { ~OPTION_MASK_ISA_64BIT, CODE_FOR_pause, "__builtin_ia32_pause", IX86_BUILTIN_PAUSE, UNKNOWN, (int) VOID_FTYPE_VOID },
 
   /* MMX */
   { OPTION_MASK_ISA_MMX, CODE_FOR_mmx_emms, "__builtin_ia32_emms", IX86_BUILTIN_EMMS, UNKNOWN, (int) VOID_FTYPE_VOID },
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 49f1ee7..801573c 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -108,6 +108,7 @@
   UNSPEC_TRUNC_NOOP
   UNSPEC_DIV_ALREADY_SPLIT
   UNSPEC_CALL_NEEDS_VZEROUPPER
+  UNSPEC_PAUSE
 
   ;; For SSE/MMX support:
   UNSPEC_FIX_NOTRUNC
@@ -17716,6 +17717,25 @@
   [(set_attr "type" "other")
(set_attr "prefix_extra" "1")])
 
+(define_expand "pause"
+  [(set (match_dup 0)
+	(unspec:BLK [(match_dup 0)] UNSPEC_PAUSE))]
+  ""
+{
+  operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+  MEM_VOLATILE_P (operands[0]) = 1;
+})
+
+;; Use "rep; nop", instead of "pause", to support older assemblers.
+;; They have the same encoding.
+(define_insn "*pause"
+  [(set (match_operand:BLK 0 "" "")
+	(unspec:BLK [(match_dup 0)] UNSPEC_PAUSE))]
+  ""
+  "rep; nop"
+  [(set_attr "length" "2")
+   (set_attr "memory" "unknown")])
+
 (include "mmx.md")
 (include "sse.md")
 (include "sync.md")
diff --git a/gcc/config/i386/ia32intrin.h b/gcc/config/i386/ia32intrin.h
index 76c20a6..42ebd17 100644
--- a/gcc/config/i386/ia32intrin.h
+++ b/gcc/config/i386/ia32intrin.h
@@ -153,6 +153,14 @@ __rord (unsigned int __X, int __C)
   return (__X >> __C) | (__X << (32 - __C));
 }
 
+/* Pause */
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__pause (void)
+{
+  __builtin_ia32_pause ();
+}
+
 #ifdef __x86_64__
 /* 64bit bsf */
 extern __inline int
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index b5702db..bd2f080 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -8695,6 +8695,13 @@ __float128 __builtin_fabsq (__float128)
 __float128 __builtin_copysignq (__float128, __float128)
 @end smallexample
 
+The following built-in function is always available.
+
+@table @code
+@item void __builtin_ia32_pause (void)
+Generates the @code{pause} machine instruction with full memory barrier.
+@end table
+
 The following floating point built-in functions are made available in the
 64-bit mode.
 
diff --git a/gcc/testsuite/gcc.target/i386/pause-1.c b/gcc/testsuite/gcc.target/i386/pause-1.c
new file mode 100644
index 000..50eb8e7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pause-1.c
@@ -0,0 +1,11 @@
+/* Test that we generate pause instruction.  */
+/* { dg-do compile } */
+/* { dg-options "-O2 -dp" } */
+/* { dg-final { scan-assembler-times "\\*pause" 1 } } */
+
+#include 
+
+void foo(void)
+{
+  __pause();
+}


[google] Minor cleanups (issue4517103)

2011-05-24 Thread Diego Novillo

This patch is in preparation of an extension to the tree sharing code
in the streamer to also support non-trees.

The new code to stream struct lang_identifier runs into memory
problems on some extreme cases.  I have a C test case that generates
thousands of bindings with 100,000 declarations in them.  All these
are shared, but the streaming code does not realize that and dies
trying to write everything out.

The handling of IDENTIFIER_NODE did not need to also save the type,
name and length of the identifier.  All that is already handled in
common code.

This fixes 1 failure in the testsuite.

Tested on x86_64.


Diego.


* pph-streamer-in.c (pph_stream_read_tree): For IDENTIFIER_NODE,
only read fields in struct lang_identifier.
Remove FIXME pph markers.
* pph-streamer-out.c (pph_stream_write_tree): For IDENTIFIER_NODE,
only write fields in struct lang_identifier.
Remove FIXME pph markers.

diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index d40fd17..c914f86 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -824,7 +824,6 @@ pph_stream_read_tree (struct lto_input_block *ib 
ATTRIBUTE_UNUSED,
   if (DECL_P (expr))
 {
   DECL_INITIAL (expr) = pph_input_tree (stream);
-  /* FIXME pph: DECL_NAME (expr) = pph_input_tree (stream); */
 
   if (TREE_CODE (expr) == FUNCTION_DECL
  || TREE_CODE (expr) == NAMESPACE_DECL
@@ -864,14 +863,7 @@ pph_stream_read_tree (struct lto_input_block *ib 
ATTRIBUTE_UNUSED,
 }
   else if (TREE_CODE (expr) == IDENTIFIER_NODE)
 {
-  const char *str;
-  struct lang_identifier *id = LANG_IDENTIFIER_CAST(expr);
-  TREE_TYPE (expr) = pph_input_tree (stream);
-  str = pph_input_string (stream);
-  /* FIXME pph: There must be a better way.  */
-  IDENTIFIER_NODE_CHECK (expr)->identifier.id.str
-  = (const unsigned char *)str;
-  IDENTIFIER_LENGTH (expr) = strlen (str);
+  struct lang_identifier *id = LANG_IDENTIFIER_CAST (expr);
   id->namespace_bindings = pph_stream_read_cxx_binding (stream);
   id->bindings = pph_stream_read_cxx_binding (stream);
   id->class_template_info = pph_input_tree (stream);
@@ -904,11 +896,6 @@ pph_stream_read_tree (struct lto_input_block *ib 
ATTRIBUTE_UNUSED,
   else if (TREE_CODE (expr) == TEMPLATE_INFO)
 {
   TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (expr)
-  = pph_stream_read_tree_vec (stream);
+  = pph_stream_read_qual_use_vec (stream);
 }
-  else if (TREE_CODE (expr) == TREE_LIST)
-; /* FIXME pph: already handled?  */
-  else if (flag_pph_debug >= 2)
-fprintf (pph_logfile, "PPH: unimplemented read of %s\n",
- tree_code_name[TREE_CODE (expr)]);
 }
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index a744ae8..1fd9a23 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -825,9 +825,6 @@ pph_stream_write_tree (struct output_block *ob, tree expr, 
bool ref_p)
   if (DECL_P (expr))
 {
   pph_output_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
-  /* FIXME pph:
-  pph_output_tree_or_ref_1 (stream, DECL_NAME (expr), ref_p, 3);
-  */
 
   if (TREE_CODE (expr) == FUNCTION_DECL
  || TREE_CODE (expr) == NAMESPACE_DECL
@@ -874,10 +871,7 @@ pph_stream_write_tree (struct output_block *ob, tree expr, 
bool ref_p)
 }
   else if (TREE_CODE (expr) == IDENTIFIER_NODE)
 {
-  struct lang_identifier *id = LANG_IDENTIFIER_CAST(expr);
-  pph_output_tree_or_ref_1 (stream, TREE_TYPE (expr), ref_p, 3);
-  pph_output_string_with_length (stream, IDENTIFIER_POINTER (expr),
- IDENTIFIER_LENGTH (expr));
+  struct lang_identifier *id = LANG_IDENTIFIER_CAST (expr);
   pph_stream_write_cxx_binding (stream, id->namespace_bindings, ref_p);
   pph_stream_write_cxx_binding (stream, id->bindings, ref_p);
   pph_output_tree_or_ref_1 (stream, id->class_template_info, ref_p, 3);
@@ -907,18 +901,12 @@ pph_stream_write_tree (struct output_block *ob, tree 
expr, bool ref_p)
   pph_output_tree_or_ref_1 (stream, DECL_TEMPLATE_RESULT (expr), ref_p, 3);
   pph_output_tree_or_ref_1 (stream, DECL_TEMPLATE_PARMS (expr), ref_p, 3);
   pph_output_tree_or_ref_1 (stream, DECL_CONTEXT (expr), ref_p, 3);
-  /* FIXME pph: what of bit DECL_MEMBER_TEMPLATE_P (expr) */
 }
   else if (TREE_CODE (expr) == TEMPLATE_INFO)
 {
   pph_stream_write_qual_use_vec (stream,
   TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (expr), ref_p);
 }
-  else if (TREE_CODE (expr) == TREE_LIST)
-; /* FIXME pph: already handled?  */
-  else if (flag_pph_debug >= 2)
-fprintf (pph_logfile, "PPH: unimplemented write of %s\n",
- tree_code_name[TREE_CODE (expr)]);
 }
 
 

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


[PATCH 3/5] Remove continue from loop, add one more assert.

2011-05-24 Thread Sebastian Pop
2011-05-24  Sebastian Pop  

* graphite-dependences.c (build_alias_set_powerset): Remove
continue from loop, add one more assert.
---
 gcc/ChangeLog.graphite |5 +
 gcc/graphite-dependences.c |   15 ++-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index af1c764..afcac69 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,10 @@
 2011-05-24  Sebastian Pop  
 
+   * graphite-dependences.c (build_alias_set_powerset): Remove
+   continue from loop, add one more assert.
+
+2011-05-24  Sebastian Pop  
+
* graphite-dependences.c (graphite_outer_subscript_bound): Remove
unused parameter.
* graphite-dependences.h (graphite_outer_subscript_bound): Same.
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 87a8bef..cf68507 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -171,19 +171,16 @@ build_alias_set_powerset 
(ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset,
 {
   ppl_dimension_type *ds;
   ppl_dimension_type access_dim;
-  unsigned i, pos = 0;
+  unsigned i, pos;
 
   ppl_Pointset_Powerset_C_Polyhedron_space_dimension (alias_powerset,
  &access_dim);
-  ds = XNEWVEC (ppl_dimension_type, access_dim-1);
-  for (i = 0; i < access_dim; i++)
-{
-  if (i == alias_dim)
-   continue;
+  ds = XNEWVEC (ppl_dimension_type, access_dim - 1);
+  gcc_assert (alias_dim < access_dim);
 
-  ds[pos] = i;
-  pos++;
-}
+  for (pos = 0, i = 0; i < access_dim; i++)
+if (i != alias_dim)
+  ds[pos++] = i;
 
   ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions (alias_powerset,
  ds,
-- 
1.7.4.1




[PATCH 5/5] Fix typo.

2011-05-24 Thread Sebastian Pop
2011-05-24  Sebastian Pop  

* graphite-opencl-codegen.c (opencl_print_local_vars): Fix typo.
---
 gcc/ChangeLog.graphite|4 
 gcc/graphite-opencl-codegen.c |6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 9f71fe8..a4130b9 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,9 @@
 2011-05-24  Sebastian Pop  
 
+   * graphite-opencl-codegen.c (opencl_print_local_vars): Fix typo.
+
+2011-05-24  Sebastian Pop  
+
* graphite-dependences.c (graphite_outer_subscript_bound): Remove
memory leaks, add one more assert.
 
diff --git a/gcc/graphite-opencl-codegen.c b/gcc/graphite-opencl-codegen.c
index 891fef0..e2eea2e 100644
--- a/gcc/graphite-opencl-codegen.c
+++ b/gcc/graphite-opencl-codegen.c
@@ -682,7 +682,7 @@ opencl_perfect_nested_to_kernel (opencl_main code_gen, 
struct clast_for *f,
innermost iterators to append respectively.  */
 
 static void
-opencl_print_local_vars (const char *fist, const char *last,
+opencl_print_local_vars (const char *first, const char *last,
 const char *type, opencl_main code_gen)
 {
   char **names = cloog_names_scattering (code_gen->root_names);
@@ -693,7 +693,7 @@ opencl_print_local_vars (const char *fist, const char *last,
 {
   const char *tmp = names[i];
 
-  if (opencl_cmp_scat (fist, tmp) <= 0
+  if (opencl_cmp_scat (first, tmp) <= 0
  && opencl_cmp_scat (last, tmp) >= 0)
{
  const char **slot =
@@ -703,7 +703,7 @@ opencl_print_local_vars (const char *fist, const char *last,
  continue;
}
 
-  if (opencl_cmp_scat (fist, tmp) > 0)
+  if (opencl_cmp_scat (first, tmp) > 0)
continue;
 
   opencl_append_string_to_body (type, code_gen);
-- 
1.7.4.1




[PATCH 1/5] Use zero_dim_array_p instead of graphite_artificial_array_p.

2011-05-24 Thread Sebastian Pop
2011-05-24  Alexey Kravets  

* graphite-opencl.c (opencl_private_var_name_p): Removed.
(graphite_artificial_array_p): Removed.
(opencl_data_create): Use zero_dim_array_p instead of
graphite_artificial_array_p.
---
 gcc/ChangeLog.graphite |7 +++
 gcc/graphite-opencl.c  |   38 +-
 2 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index b1fa8ca..50948b6 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,10 @@
+2011-05-24  Alexey Kravets  
+
+   * graphite-opencl.c (opencl_private_var_name_p): Removed.
+   (graphite_artificial_array_p): Removed.
+   (opencl_data_create): Use zero_dim_array_p instead of
+   graphite_artificial_array_p.
+
 2011-01-25  Sebastian Pop  
 
* graphite-opencl.c (opencl_create_function_call): Use cl_khr_fp64
diff --git a/gcc/graphite-opencl.c b/gcc/graphite-opencl.c
index ea894ee..53704d2 100644
--- a/gcc/graphite-opencl.c
+++ b/gcc/graphite-opencl.c
@@ -330,42 +330,6 @@ zero_dim_array_p (tree var)
   return TREE_INT_CST_LOW (up_bound) == 0;
 }
 
-/* Check whether NAME is the name of the artificial array, which can be
-   privatized.  */
-
-static bool
-opencl_private_var_name_p (const char *name)
-{
-  static const char *general_reduction = "General_Reduction";
-  static const char *close_phi = "Close_Phi";
-  static const char *cross_bb = "Cross_BB_scalar_dependence";
-  static const char *commutative = "Commutative_Associative_Reduction";
-
-  if (!name)
-return false;
-
-  return
-((strstr (name, general_reduction) == name)
- || (strstr (name, close_phi) == name)
- || (strstr (name, commutative) == name)
- || (strstr (name, cross_bb) == name));
-}
-
-/* Check whether VAR is an artificial array, which can be privatized.  */
-
-static bool
-graphite_artificial_array_p (tree var)
-{
-  tree name;
-
-  if (TREE_CODE (var) != VAR_DECL
-  || !zero_dim_array_p (var)
-  || !(name = DECL_NAME (var)))
-return false;
-
-  return opencl_private_var_name_p (IDENTIFIER_POINTER (name));
-}
-
 /* Get depth of type TYPE scalar (base) part.  */
 
 static int
@@ -393,7 +357,7 @@ opencl_data_create (tree var, tree size)
   opencl_data tmp = XNEW (struct opencl_data_def);
   tree type = TREE_TYPE (var);
 
-  tmp->can_be_private = graphite_artificial_array_p (var);
+  tmp->can_be_private = zero_dim_array_p (var);
   tmp->exact_object = var;
 
   tmp->supported = TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == SSA_NAME;
-- 
1.7.4.1




[PATCH 2/5] Remove unused parameter.

2011-05-24 Thread Sebastian Pop
2011-05-24  Sebastian Pop  

* graphite-dependences.c (graphite_outer_subscript_bound): Remove
unused parameter.
* graphite-dependences.h (graphite_outer_subscript_bound): Same.
* graphite-opencl-meta-clast.c (opencl_set_meta_rw_flags): Update
call to graphite_outer_subscript_bound.
* graphite-opencl.c (opencl_get_indirect_size): Same.
---
 gcc/ChangeLog.graphite   |9 +
 gcc/graphite-dependences.c   |3 +--
 gcc/graphite-dependences.h   |2 +-
 gcc/graphite-opencl-meta-clast.c |2 +-
 gcc/graphite-opencl.c|2 +-
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 50948b6..af1c764 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,12 @@
+2011-05-24  Sebastian Pop  
+
+   * graphite-dependences.c (graphite_outer_subscript_bound): Remove
+   unused parameter.
+   * graphite-dependences.h (graphite_outer_subscript_bound): Same.
+   * graphite-opencl-meta-clast.c (opencl_set_meta_rw_flags): Update
+   call to graphite_outer_subscript_bound.
+   * graphite-opencl.c (opencl_get_indirect_size): Same.
+
 2011-05-24  Alexey Kravets  
 
* graphite-opencl.c (opencl_private_var_name_p): Removed.
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 6129905..87a8bef 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -743,8 +743,7 @@ graphite_legal_transform (scop_p scop)
type is INDIRECT_REF), or NULL if the bound could not be found.  */
 
 tree
-graphite_outer_subscript_bound (poly_dr_p pdr,
-   bool minmax ATTRIBUTE_UNUSED)
+graphite_outer_subscript_bound (poly_dr_p pdr)
 {
   tree bound_tree = NULL_TREE;
   poly_bb_p pbb = PDR_PBB (pdr);
diff --git a/gcc/graphite-dependences.h b/gcc/graphite-dependences.h
index a852411..2aef478 100644
--- a/gcc/graphite-dependences.h
+++ b/gcc/graphite-dependences.h
@@ -60,7 +60,7 @@ extern hashval_t hash_poly_ddr_p (const void *);
 extern void free_poly_ddr (void *);
 extern void dot_deps (scop_p);
 extern void dot_deps_stmt (scop_p);
-extern tree graphite_outer_subscript_bound (poly_dr_p, bool);
+extern tree graphite_outer_subscript_bound (poly_dr_p);
 extern void print_pddr (FILE *, poly_ddr_p);
 extern void debug_pddr (poly_ddr_p);
 
diff --git a/gcc/graphite-opencl-meta-clast.c b/gcc/graphite-opencl-meta-clast.c
index 256ccc2..6e18de4 100644
--- a/gcc/graphite-opencl-meta-clast.c
+++ b/gcc/graphite-opencl-meta-clast.c
@@ -433,7 +433,7 @@ opencl_set_meta_rw_flags (opencl_clast_meta meta,
   if (!data->supported)
 meta->access_unsupported = true;
 
-  if (!graphite_outer_subscript_bound (curr, false))
+  if (!graphite_outer_subscript_bound (curr))
 {
   meta->access_unsupported = true;
 
diff --git a/gcc/graphite-opencl.c b/gcc/graphite-opencl.c
index 53704d2..0d53f66 100644
--- a/gcc/graphite-opencl.c
+++ b/gcc/graphite-opencl.c
@@ -1419,7 +1419,7 @@ opencl_get_indirect_size (tree ptr, poly_dr_p ref)
 case POINTER_TYPE:
   {
tree inner_type = TREE_TYPE (ptr);
-   tree t = graphite_outer_subscript_bound (ref, false);
+   tree t = graphite_outer_subscript_bound (ref);
tree inner_type_size = TYPE_SIZE_UNIT (inner_type);
 
if (inner_type_size == NULL)
-- 
1.7.4.1




[PATCH 0/5] Graphite branch cleanups

2011-05-24 Thread Sebastian Pop
Hi,
I have committed the following patches to the graphite branch:

  Use zero_dim_array_p instead of graphite_artificial_array_p.
  Remove unused parameter.
  Remove continue from loop, add one more assert.
  Remove memory leaks, add one more assert.
  Fix typo.

 gcc/ChangeLog.graphite   |   30 
 gcc/graphite-dependences.c   |   39 +++--
 gcc/graphite-dependences.h   |2 +-
 gcc/graphite-opencl-codegen.c|6 ++--
 gcc/graphite-opencl-meta-clast.c |2 +-
 gcc/graphite-opencl.c|   40 +
 6 files changed, 57 insertions(+), 62 deletions(-)




[PATCH 4/5] Remove memory leaks, add one more assert.

2011-05-24 Thread Sebastian Pop
2011-05-24  Sebastian Pop  

* graphite-dependences.c (graphite_outer_subscript_bound): Remove
memory leaks, add one more assert.
---
 gcc/ChangeLog.graphite |5 +
 gcc/graphite-dependences.c |   21 +
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index afcac69..9f71fe8 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,10 @@
 2011-05-24  Sebastian Pop  
 
+   * graphite-dependences.c (graphite_outer_subscript_bound): Remove
+   memory leaks, add one more assert.
+
+2011-05-24  Sebastian Pop  
+
* graphite-dependences.c (build_alias_set_powerset): Remove
continue from loop, add one more assert.
 
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index cf68507..840c004 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -754,7 +754,7 @@ graphite_outer_subscript_bound (poly_dr_p pdr)
   graphite_dim_t gdim = scop_nb_params (scop);
 
   graphite_dim_t dim = tdim + dim1;
-
+  unsigned i, pos, sub1_dim = dim - sdim + 1 - gdim;
   ppl_Pointset_Powerset_C_Polyhedron_t isc, idr, res;
 
   combine_context_id_scat (&isc, pbb, false);
@@ -772,23 +772,28 @@ graphite_outer_subscript_bound (poly_dr_p pdr)
   {
 ppl_Linear_Expression_t le;
 ppl_Coefficient_t coef;
-mpz_t v;
-unsigned i;
+mpz_t one;
 
-mpz_init (v);
-mpz_set_si (v, 1);
+mpz_init (one);
+mpz_set_si (one, 1);
 ppl_new_Coefficient (&coef);
-ppl_assign_Coefficient_from_mpz_t (coef, v);
+ppl_assign_Coefficient_from_mpz_t (coef, one);
 
 ppl_new_Linear_Expression_with_dimension (&le, dim);
 
-for (i = 0; i < dim - sdim + 1 - gdim; i++)
+for (i = 0; i < sub1_dim; i++)
   ppl_Pointset_Powerset_C_Polyhedron_affine_image (res, i, le, coef);
+
+ppl_delete_Linear_Expression (le);
+ppl_delete_Coefficient (coef);
+mpz_clear (one);
   }
 
   {
 ppl_dimension_type *ds = XNEWVEC (ppl_dimension_type, dim - gdim - 1);
-unsigned i, pos, sub1_dim = dim - sdim + 1 - gdim;
+
+gcc_assert (sub1_dim < dim - gdim);
+
 for (i = 0, pos = 0; i < dim - gdim; i++)
   if (i != sub1_dim)
ds[pos++] = i;
-- 
1.7.4.1




[testsuite] remove XFAIL for all but ia64 for g++.dg/tree-ssa/pr43411.C

2011-05-24 Thread Janis Johnson
Archived test results for 4.7.0 for most processors with C++ results have:

XPASS: g++.dg/tree-ssa/pr43411.C scan-tree-dump-not optimized "OBJ_TYPE_REF"

The only failures I could find were for ia64-linux and ia64-hpux.  This
patch changes the xfail so it only applies to ia64-*-*.  OK for trunk?
2011-05-24  Janis Johnson  

* g++.dg/tree-ssa/pr43411.C: Limit xfail to ia64.

Index: g++.dg/tree-ssa/pr43411.C
===
--- g++.dg/tree-ssa/pr43411.C   (revision 174094)
+++ g++.dg/tree-ssa/pr43411.C   (working copy)
@@ -25,5 +25,5 @@
 sink1 = v(p);
 }
 
-// { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "optimized" { xfail *-*-* } 
} }
+// { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "optimized" { xfail ia64-*-* 
} } }
 // { dg-final { cleanup-tree-dump "optimized" } }


[testsuite] remove arm from xfail list for g++.dg/other/packed1.C

2011-05-24 Thread Janis Johnson
All archived test results for ARM for 4.7.0 and 4.6.1 with g++
results include:

XPASS: g++.dg/other/packed1.C execution test

This patch removes arm-*-* from the xfail list for this test.  OK for
trunk and 4.6?
2011-05-24  Janis Johnson  

* g++.dg/other/packed1.C: Remove arm from xfail list.

Index: g++.dg/other/packed1.C
===
--- g++.dg/other/packed1.C  (revision 174094)
+++ g++.dg/other/packed1.C  (working copy)
@@ -1,4 +1,4 @@
-// { dg-do run { xfail arm*-*-* sh-*-* lm32-*-* } }
+// { dg-do run { xfail sh-*-* lm32-*-* } }
 
 // NMS:2003-04-21 this fails on strict aligned architectures again,
 // the patch was reverted because it broke something more important.


Re: [patch][simplify-rtx] Fix 16-bit -> 64-bit multiply and accumulate

2011-05-24 Thread Joseph S. Myers
On Tue, 24 May 2011, Andrew Stubbs wrote:

> I've created this new, simpler patch that converts
> 
>   (extend (mult a b))
> 
> into
> 
>   (mult (extend a) (extend b))
> 
> regardless of what 'a' and 'b' might be. (These are then simplified and
> superfluous extends removed, of course.)

Are there some missing conditions here?  The two aren't equivalent in 
general - (extend:SI (mult:HI a b)) multiplies the HImode values in HImode 
(with modulo arithmetic on overflow) before extending the possibly wrapped 
result to SImode.  You'd need a and b themselves to be extended from 
narrower modes in such a way that if you interpret the extended values in 
the signedness of the outer extension, the result of the multiplication is 
exactly representable in the mode of the multiplication.  (For example, if 
both values are extended from QImode, and all extensions have the same 
signedness, that would be OK.  There are cases that are OK where not all 
extensions have the same signedness, e.g. (sign_extend:DI (mult:SI a b)) 
where a and b are zero-extended from HImode or QImode, at least one from 
QImode, though there the outer extension is equivalent to a 
zero-extension.)

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


Re: [testsuite] ignore irrelevant warning in two ARM tests

2011-05-24 Thread Joseph S. Myers
On Tue, 24 May 2011, Janis Johnson wrote:

> On ARM, two g++ tests trigger a warning about changed mangling.  The
> warning is not relevant to the purpose of the test, so this patch
> causes it to be ignored.

Various existing tests use -Wno-abi or -Wno-psabi on particular targets 
for such cases.  E.g.

// { dg-options "-Wno-abi" { target arm_eabi } }

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


C++ PATCH for c++/48884 (access control and deduction)

2011-05-24 Thread Jason Merrill
In this PR, we had a problem with hitting access control violations 
during the substitution of template arguments in the context of template 
argument deduction.  If we're going to be doing access checking at all 
during deduction substitution, we need to do it in the context of the 
function we're doing deduction for.  In C++98 mode we just disable 
access checking.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit ffb9b449d208ef324c092df35460d9e0b34eacfd
Author: Jason Merrill 
Date:   Mon May 23 16:02:45 2011 -0400

	PR c++/48884
	* class.c (pushclass): Accept NULL argument.
	(popclass): Deal with popping null class.
	* pt.c (push_access_scope, pop_access_scope): Use them rather than
	push_to_top_level/pop_from_top_level.
	(push_deduction_access_scope, pop_defarg_context): New.
	(fn_type_unification): Use them.
	* name-lookup.c (lookup_name_real_1): Check current_class_type.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 4e52b18..69627cb 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6082,6 +6082,9 @@ restore_class_cache (void)
So that we may avoid calls to lookup_name, we cache the _TYPE
nodes of local TYPE_DECLs in the TREE_TYPE field of the name.
 
+   For use by push_access_scope, we allow TYPE to be null to temporarily
+   push out of class scope.  This does not actually change binding levels.
+
For multiple inheritance, we perform a two-pass depth-first search
of the type lattice.  */
 
@@ -6090,8 +6093,6 @@ pushclass (tree type)
 {
   class_stack_node_t csn;
 
-  type = TYPE_MAIN_VARIANT (type);
-
   /* Make sure there is enough room for the new entry on the stack.  */
   if (current_class_depth + 1 >= current_class_stack_size)
 {
@@ -6110,6 +6111,15 @@ pushclass (tree type)
   csn->hidden = 0;
   current_class_depth++;
 
+  if (type == NULL_TREE)
+{
+  current_class_name = current_class_type = NULL_TREE;
+  csn->hidden = true;
+  return;
+}
+
+  type = TYPE_MAIN_VARIANT (type);
+
   /* Now set up the new type.  */
   current_class_name = TYPE_NAME (type);
   if (TREE_CODE (current_class_name) == TYPE_DECL)
@@ -6154,7 +6164,11 @@ invalidate_class_lookup_cache (void)
 void
 popclass (void)
 {
-  poplevel_class ();
+  if (current_class_type)
+poplevel_class ();
+  else
+gcc_assert (current_class_depth
+		&& current_class_stack[current_class_depth - 1].hidden);
 
   current_class_depth--;
   current_class_name = current_class_stack[current_class_depth].name;
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 3d1c64d..bb6d4b9 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4469,7 +4469,7 @@ lookup_name_real_1 (tree name, int prefer_type, int nonclass, bool block_p,
   /* Conversion operators are handled specially because ordinary
  unqualified name lookup will not find template conversion
  operators.  */
-  if (IDENTIFIER_TYPENAME_P (name))
+  if (IDENTIFIER_TYPENAME_P (name) && current_class_type)
 {
   struct cp_binding_level *level;
 
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index dbff91e..98844c3 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -212,7 +212,7 @@ push_access_scope (tree t)
   else if (DECL_CLASS_SCOPE_P (t))
 push_nested_class (DECL_CONTEXT (t));
   else
-push_to_top_level ();
+pushclass (NULL_TREE);
 
   if (TREE_CODE (t) == FUNCTION_DECL)
 {
@@ -237,7 +237,7 @@ pop_access_scope (tree t)
   if (DECL_FRIEND_CONTEXT (t) || DECL_CLASS_SCOPE_P (t))
 pop_nested_class ();
   else
-pop_from_top_level ();
+popclass ();
 }
 
 /* Do any processing required when DECL (a member template
@@ -13820,6 +13820,30 @@ instantiate_template (tree tmpl, tree orig_args, tsubst_flags_t complain)
   return ret;
 }
 
+/* We're going to do deduction substitution on the type of TMPL, a function
+   template.  In C++11 mode, push into that access scope.  In C++03 mode,
+   disable access checking.  */
+
+static void
+push_deduction_access_scope (tree tmpl)
+{
+  if (cxx_dialect >= cxx0x)
+push_access_scope (DECL_TEMPLATE_RESULT (tmpl));
+  else
+push_deferring_access_checks (dk_no_check);
+}
+
+/* And pop back out.  */
+
+static void
+pop_deduction_access_scope (tree tmpl)
+{
+  if (cxx_dialect >= cxx0x)
+pop_access_scope (DECL_TEMPLATE_RESULT (tmpl));
+  else
+pop_deferring_access_checks ();
+}
+
 /* The FN is a TEMPLATE_DECL for a function.  ARGS is an array with
NARGS elements of the arguments that are being used when calling
it.  TARGS is a vector into which the deduced template arguments
@@ -13958,7 +13982,9 @@ fn_type_unification (tree fn,
 incomplete = NUM_TMPL_ARGS (explicit_targs) != NUM_TMPL_ARGS (targs);
 
   processing_template_decl += incomplete;
+  push_deduction_access_scope (fn);
   fntype = deduction_tsubst_fntype (fn, converted_args);
+  pop_deduction_access_scope (fn);
   processing_template_decl -= incomplete;
 
   if (fntype == error_mark_node)
@@ -14029,7 +14055,10 @@ f

RFA: patch for PR48757

2011-05-24 Thread Vladimir Makarov
The following patch solves PR48757.  It is just a slight modification of 
code for PR48633.


2011-05-24  Vladimir Makarov 

PR rtl-optimization/48757
* ira-build.c (loop_with_eh_edge_p): Rename to
loop_with_complex_edge_p, check edges on complexity, make function
conditional.
(mark_loops_for_removal): Make call of loop_with_complex_edge_p
conditional.

2011-05-24  Vladimir Makarov 

PR rtl-optimization/48757
* gfortran.dg/pr48757.f:  New test case.


The patch was successfully bootstrapped on x86-64.

Ok to commit?

Index: ira-build.c
===
--- ira-build.c (revision 174124)
+++ ira-build.c (working copy)
@@ -1806,9 +1806,12 @@ low_pressure_loop_node_p (ira_loop_tree_
   return true;
 }
 
-/* Return TRUE if LOOP has a EH enter or exit edge.  */
+#ifdef STACK_REGS
+/* Return TRUE if LOOP has a complex enter or exit edge.  We don't
+   form a region from such loop if the target use stack register
+   because reg-stack.c can not deal with such edges.  */
 static bool
-loop_with_eh_edge_p (struct loop *loop)
+loop_with_complex_edge_p (struct loop *loop)
 {
   int i;
   edge_iterator ei;
@@ -1820,10 +1823,11 @@ loop_with_eh_edge_p (struct loop *loop)
   return true;
   edges = get_loop_exit_edges (loop);
   FOR_EACH_VEC_ELT (edge, edges, i, e)
-if (e->flags & EDGE_EH)
+if (e->flags & EDGE_COMPLEX)
   return true;
   return false;
 }
+#endif
 
 /* Sort loops for marking them for removal.  We put already marked
loops first, then less frequent loops next, and then outer loops
@@ -1884,7 +1888,10 @@ mark_loops_for_removal (void)
ira_loop_nodes[i].to_remove_p
  = ((low_pressure_loop_node_p (ira_loop_nodes[i].parent)
  && low_pressure_loop_node_p (&ira_loop_nodes[i]))
-|| loop_with_eh_edge_p (ira_loop_nodes[i].loop));
+#ifdef STACK_REGS
+|| loop_with_complex_edge_p (ira_loop_nodes[i].loop)
+#endif
+);
   }
   qsort (sorted_loops, n, sizeof (ira_loop_tree_node_t), loop_compare_func);
   for (i = 0; n - i + 1 > IRA_MAX_LOOPS_NUM; i++)
Index: testsuite/gfortran.dg/pr48757.f
===
--- testsuite/gfortran.dg/pr48757.f (revision 0)
+++ testsuite/gfortran.dg/pr48757.f (revision 0)
@@ -0,0 +1,54 @@
+! { dg-do compile { target i?86-*-* x86_64-*-* } }
+! { dg-options "-O2 -w" }
+C fconc64.F, from CERNLIB (simplified)
+
+  FUNCTION DFCONC(X,TAU,M)
+  IMPLICIT DOUBLE PRECISION (A-H,O-Z)
+  COMPLEX*16 WGAMMA,WLOGAM
+  COMPLEX*16 CGM,CLG,CRG,I,A,B,C,TI,R,RR,U(0:3),V(0:3),W(19)
+  LOGICAL LM0,LM1,LTA
+  CHARACTER NAME*(*)
+  CHARACTER*80 ERRTXT
+  PARAMETER (NAME = 'RFCONC/DFCONC')
+  DIMENSION T(7),H(9),S(5),P(11),D(-1:6)
+  PARAMETER (PI  = 3.14159 26535 89793 24D+0)
+  PARAMETER (RPI = 1.77245 38509 05516 03D+0)
+  PARAMETER (I = (0,1))
+  PARAMETER (Z1 = 1, HF = Z1/2, TH = 1+HF, C1 = Z1/10, C2 = Z1/5)
+  PARAMETER (RPH = 2/PI, RPW = 2/RPI, TW = 20, NMAX = 200)
+  DATA EPS /1D-14/
+  ASSIGN 1 TO JP
+  GO TO 20
+1 ASSIGN 2 TO JP
+  GO TO 20
+2 IF(LM1) FC=2*FC/SQRT(1-X1)
+  GO TO 99
+   12 ASSIGN 3 TO JP
+  GO TO 20
+3 IF(LM1) FC=SIGN(HF,1-X)*(TAU**2+HF**2)*SQRT(ABS(X**2-1))*FC
+  GO TO 99
+   13 ASSIGN 4 TO JP
+  GO TO 20
+4 R1=EXP((TI-HF)*LOG(X+X)+CLG(1+TI)-CLG((TH-FM)+TI))*
+ 1R*((HF-FM)+TI)/TI
+  FC=RPW*R1
+  IF(LM1) FC=FC/SQRT(1-X1)
+  GO TO 99
+   20 IF(LTA) THEN
+   IF(ABS(R-RR) .LT. EPS) GO TO JP, (1,2,3,4)
+  ELSE
+   W(1)=X1*A*B/C
+   R=1+W(1)
+   DO 23 N = 1,NMAX
+   RR=R
+   W(1)=W(1)*X1*(A+FN)*(B+FN)/((C+FN)*(FN+1))
+   IF(ABS(R-RR) .LT. EPS) GO TO JP, (1,2,3,4)
+   23  CONTINUE
+  END IF
+   99 DFCONC=FC
+  RETURN
+  101 FORMAT('ILLEGAL ARGUMENT(S)  X = ',D15.8,' TAU = ',D15.8,
+ 1   ' M = ',I3)
+  102 FORMAT('CONVERGENCE PROBLEM FOR HYPERGEOMETRIC FUNCTION, X = ',
+ 1D15.8)
+  END


Re: Patch fixing PR objc/48187

2011-05-24 Thread Mike Stump
On May 24, 2011, at 10:06 AM, Nicola Pero wrote:
> This routine patch fixes PR objc/48187.

> Ok to commit ?

Ok.


Re: Go patch committed: Update to current Go library

2011-05-24 Thread Ian Lance Taylor
Rainer Orth  writes:

>  includes , which leads to
>
> // type ___FILE struct { _cnt int32; _ptr *uint8; _base *uint8; _flag uint8; 
> _magic uint8; __orientation INVALID-bit-field; __ionolock INVALID-bit-field; 
> __seekable INVALID-bit-field; __extendedfd INVALID-bit-field; __xf_nocheck 
> INVALID-bit-field; __filler INVALID-bit-field; }
> // type _FILE struct { _cnt int32; _ptr *uint8; _base *uint8; _flag uint8; 
> _magi
> c uint8; __orientation INVALID-bit-field; __ionolock INVALID-bit-field; 
> __seekab
> le INVALID-bit-field; __extendedfd INVALID-bit-field; __xf_nocheck 
> INVALID-bit-f
> ield; __filler INVALID-bit-field; }
> var ___iob [59+1]___FILE
> var __lastbuf *_FILE
>
> in gen-sysinfo.go.

I just committed a patch to godump.c which I think should fix this
issue.  Let me know if it doesn't.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian


2011-05-24  Ian Lance Taylor  

* godump.c (struct godump_container): Add invalid_hash field.
(go_format_type): Return false if type is found in invalid_hash.
(go_output_typedef): Add invalid type to invalid_hash.
(go_finish): Create and delete invalid_hash.


Index: godump.c
===
--- godump.c	(revision 174138)
+++ godump.c	(working copy)
@@ -464,6 +464,9 @@ struct godump_container
   /* Global type definitions.  */
   htab_t type_hash;
 
+  /* Invalid types.  */
+  htab_t invalid_hash;
+
   /* Obstack used to write out a type definition.  */
   struct obstack type_obstack;
 };
@@ -500,20 +503,20 @@ go_format_type (struct godump_container 
 	  || TREE_CODE (type) == FUNCTION_TYPE))
 {
   tree name;
+  void **slot;
 
   name = TYPE_NAME (type);
-  if (TREE_CODE (name) == IDENTIFIER_NODE)
-	{
-	  obstack_1grow (ob, '_');
-	  go_append_string (ob, name);
-	  return ret;
-	}
-  else if (TREE_CODE (name) == TYPE_DECL)
-	{
-	  obstack_1grow (ob, '_');
-	  go_append_string (ob, DECL_NAME (name));
-	  return ret;
-	}
+  if (TREE_CODE (name) == TYPE_DECL)
+	name = DECL_NAME (name);
+
+  slot = htab_find_slot (container->invalid_hash, IDENTIFIER_POINTER (name),
+			 NO_INSERT);
+  if (slot != NULL)
+	ret = false;
+
+  obstack_1grow (ob, '_');
+  go_append_string (ob, name);
+  return ret;
 }
 
   pointer_set_insert (container->decls_seen, type);
@@ -879,7 +882,11 @@ go_output_typedef (struct godump_contain
   *slot = CONST_CAST (void *, (const void *) type);
 
   if (!go_format_type (container, TREE_TYPE (decl), false, false))
-	fprintf (go_dump_file, "// ");
+	{
+	  fprintf (go_dump_file, "// ");
+	  slot = htab_find_slot (container->invalid_hash, type, INSERT);
+	  *slot = CONST_CAST (void *, (const void *) type);
+	}
   fprintf (go_dump_file, "type _%s ",
 	   IDENTIFIER_POINTER (DECL_NAME (decl)));
   go_output_type (container);
@@ -898,7 +905,11 @@ go_output_typedef (struct godump_contain
*slot = CONST_CAST (void *, (const void *) type);
 
if (!go_format_type (container, TREE_TYPE (decl), false, false))
-	 fprintf (go_dump_file, "// ");
+	 {
+	   fprintf (go_dump_file, "// ");
+	   slot = htab_find_slot (container->invalid_hash, type, INSERT);
+	   *slot = CONST_CAST (void *, (const void *) type);
+	 }
fprintf (go_dump_file, "type _%s ",
 	   IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl;
go_output_type (container);
@@ -1010,6 +1021,8 @@ go_finish (const char *filename)
   container.pot_dummy_types = pointer_set_create ();
   container.type_hash = htab_create (100, htab_hash_string,
  string_hash_eq, NULL);
+  container.invalid_hash = htab_create (10, htab_hash_string,
+	string_hash_eq, NULL);
   container.keyword_hash = htab_create (50, htab_hash_string,
 string_hash_eq, NULL);
   obstack_init (&container.type_obstack);
@@ -1044,6 +1057,7 @@ go_finish (const char *filename)
   pointer_set_destroy (container.decls_seen);
   pointer_set_destroy (container.pot_dummy_types);
   htab_delete (container.type_hash);
+  htab_delete (container.invalid_hash);
   htab_delete (container.keyword_hash);
   obstack_free (&container.type_obstack, NULL);
 


Re: [testsuite] ignore irrelevant warning in two ARM tests

2011-05-24 Thread Janis Johnson
On 05/24/2011 12:40 PM, Joseph S. Myers wrote:
> On Tue, 24 May 2011, Janis Johnson wrote:
> 
>> On ARM, two g++ tests trigger a warning about changed mangling.  The
>> warning is not relevant to the purpose of the test, so this patch
>> causes it to be ignored.
> 
> Various existing tests use -Wno-abi or -Wno-psabi on particular targets 
> for such cases.  E.g.
> 
> // { dg-options "-Wno-abi" { target arm_eabi } }
> 

Is this one OK for trunk and 4.6?  The failure occurs for arm-none-eabi
and for arm-none-linux-gnueabi.

2011-05-24  Janis Johnson  

* g++.dg/template/stdarg1.C: Suppress a warning.
* g++.dg/warn/Wunused-parm-3.C: Likewise.

Index: g++.dg/template/stdarg1.C
===
--- g++.dg/template/stdarg1.C   (revision 174094)
+++ g++.dg/template/stdarg1.C   (working copy)
@@ -1,5 +1,7 @@
 // PR c++/47022
 // { dg-do compile }
+// Suppress a warning that is irrelevant to the purpose of this test.
+// { dg-options "-Wno-abi" { target arm*-*-*eabi } }
 
 #include 
 
Index: g++.dg/warn/Wunused-parm-3.C
===
--- g++.dg/warn/Wunused-parm-3.C(revision 174094)
+++ g++.dg/warn/Wunused-parm-3.C(working copy)
@@ -1,5 +1,7 @@
 // { dg-do compile }
 // { dg-options "-Wunused -W" }
+// Suppress a warning that is irrelevant to the purpose of this test.
+// { dg-options "-Wno-abi" { target arm*-*-*eabi } }
 
 #include 
 


[PATCH] Expand pow(x,n) into mulitplies in cse_sincos pass (PR46728, patch 2)

2011-05-24 Thread William J. Schmidt
Here's a small patch to expand pow(x,n) for integer n using the
powi(x,n) logic in the cse_sincos pass.  OK for trunk?

For the next patch, I'll plan on expanding pow(x,n) for n in
{0.5, 0.25, 0.75, 1./3., 1./6.}.  This logic will be added to
gimple_expand_builtin_pow.

Bill


2011-05-24  Bill Schmidt  
PR tree-optimization/46728
* tree-ssa-math-opts.c (gimple_expand_builtin_pow): New.
(execute_cse_sincos): Add switch case for BUILT_IN_POW.

Index: gcc/tree-ssa-math-opts.c
===
--- gcc/tree-ssa-math-opts.c(revision 174129)
+++ gcc/tree-ssa-math-opts.c(working copy)
@@ -1024,6 +1024,39 @@ gimple_expand_builtin_powi (gimple_stmt_iterator *
   return NULL_TREE;
 }
 
+/* ARG0 and ARG1 are the two arguments to a pow builtin call in GSI
+   with location info LOC.  If possible, create an equivalent and
+   less expensive sequence of statements prior to GSI, and return an
+   expession holding the result.  */
+
+static tree
+gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc, 
+  tree arg0, tree arg1)
+{
+  REAL_VALUE_TYPE c, cint;
+  HOST_WIDE_INT n;
+
+  /* If the exponent isn't a constant, there's nothing of interest
+ to be done.  */
+  if (TREE_CODE (arg1) != REAL_CST)
+return NULL_TREE;
+
+  /* If the exponent is equivalent to an integer, expand it into
+ multiplies when profitable.  */
+  c = TREE_REAL_CST (arg1);
+  n = real_to_integer (&c);
+  real_from_integer (&cint, VOIDmode, n, n < 0 ? -1 : 0, 0);
+
+  if (real_identical (&c, &cint)
+  && ((n >= -1 && n <= 2)
+ || (flag_unsafe_math_optimizations
+ && optimize_insn_for_speed_p ()
+ && powi_cost (n) <= POWI_MAX_MULTS)))
+return gimple_expand_builtin_powi (gsi, loc, arg0, n);
+
+  return NULL_TREE;
+}
+
 /* Go through all calls to sin, cos and cexpi and call execute_cse_sincos_1
on the SSA_NAME argument of each of them.  Also expand powi(x,n) into
an optimal number of multiplies, when n is a constant.  */
@@ -1065,6 +1098,23 @@ execute_cse_sincos (void)
cfg_changed |= execute_cse_sincos_1 (arg);
  break;
 
+   CASE_FLT_FN (BUILT_IN_POW):
+ arg0 = gimple_call_arg (stmt, 0);
+ arg1 = gimple_call_arg (stmt, 1);
+
+ loc = gimple_location (stmt);
+ result = gimple_expand_builtin_pow (&gsi, loc, arg0, arg1);
+
+ if (result)
+   {
+ tree lhs = gimple_get_lhs (stmt);
+ gimple new_stmt = gimple_build_assign (lhs, result);
+ gimple_set_location (new_stmt, loc);
+ unlink_stmt_vdef (stmt);
+ gsi_replace (&gsi, new_stmt, true);
+   }
+ break;
+
CASE_FLT_FN (BUILT_IN_POWI):
  arg0 = gimple_call_arg (stmt, 0);
  arg1 = gimple_call_arg (stmt, 1);




Re: [ C++ 4.6 Patch] allow uninitialized const or reference members with -fpermissive

2011-05-24 Thread Fabien Chêne
2011/5/22 Jason Merrill :
> I think you also need something to avoid returning error_mark_node from
> build_new_1.

Indeed. I have also added two testcases to check sfinae on 'new T',
with and without -fpermissive, which leads to a different result.
Tested x86_64-unknown-linux-gnu.
OK for 4.6 ?

I would like to add the testcase pr25811-3.C to Trunk, is it OK ?

gcc/cp/ChangeLog:

2011-05-25  Fabien Chêne  
* init.c (diagnose_uninitialized_cst_or_ref_member_1): Use
permerror instead of error, adjust the error count.

gcc/testsuite/ChangeLog:

2011-05-25  Fabien Chêne  
* g++.dg/init/pr25811-2.C: New.
* g++.dg/init/pr25811-3.C: New.
* g++.dg/init/pr25811-4.C: New.

-- 
Fabien


perm_cst_ref_diag.patch
Description: Binary data


Re: [testsuite] ignore irrelevant warning in g++.dg/abi/packed1.C

2011-05-24 Thread Mike Stump
On May 24, 2011, at 10:41 AM, Janis Johnson wrote:
> Test g++.dg/abi/packed1.C triggers a warning for several targets.

> OK for trunk and 4.6?

Ok.  If there is a portable -Wno-inefficient flag, that'd be a slightly better 
way to do this.


Re: [testsuite] ignore irrelevant warning in two ARM tests

2011-05-24 Thread Janis Johnson
On 05/24/2011 01:36 PM, Janis Johnson wrote:
> On 05/24/2011 12:40 PM, Joseph S. Myers wrote:
>> On Tue, 24 May 2011, Janis Johnson wrote:
>>
>>> On ARM, two g++ tests trigger a warning about changed mangling.  The
>>> warning is not relevant to the purpose of the test, so this patch
>>> causes it to be ignored.
>>
>> Various existing tests use -Wno-abi or -Wno-psabi on particular targets 
>> for such cases.  E.g.
>>
>> // { dg-options "-Wno-abi" { target arm_eabi } }
>>
> 
> Is this one OK for trunk and 4.6?  The failure occurs for arm-none-eabi
> and for arm-none-linux-gnueabi.

Sorry, I hadn't noticed that arm_eabi is an effective-target keyword;
I'll use that instead.


Re: Go patch committed: Update to current Go library

2011-05-24 Thread Ian Lance Taylor
Rainer Orth  writes:

> On recent Solaris 11, I also have:
>
> const __PATH_SYSVOL = "/system/volatile"
> const __PATH_UTMPX = __PATH_SYSVOL "/utmpx"
> const __PATH_VARRUN = __PATH_SYSVOL "/"
>
> For the moment, I'm just omitting the offending declarations in
> mksysinfo.sh.

This patch should fix this problem.  Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2011-05-24  Ian Lance Taylor  

* godump.c (go_define): Don't accept a string immediately after
another operand.


Index: godump.c
===
--- godump.c	(revision 174140)
+++ godump.c	(working copy)
@@ -300,7 +300,11 @@ go_define (unsigned int lineno, const ch
 	case '"':
 	case '\'':
 	  {
-	char quote = *p;
+	char quote;
+
+	if (saw_operand)
+	  goto unknown;
+	quote = *p;
 	*q++ = *p++;
 	while (*p != quote)
 	  {


Re: [patch, fortran] [4.6/4.7 Regression] Fix PR 48955

2011-05-24 Thread Paul Richard Thomas
Dear All,
>
> I have posted a simpler alternative on the PR that uses your
> suggestion that forward and backward dependences need to to be
> recorded to get this right.
>
> I believe that it's OK but have only now had the opportunity to put it
> on to regtest.
>

Following some comments from Thomas, the attached is the version that
I wound up with.  Tell us which one you prefer and Thomas and I will
do the honours.

Bootstrapped and regtested on FC9/x86_64  - OK for trunk and 4.6?

Paul

2011-05-24  Paul Thomas  
Thomas Koenig  

PR fortran/48955
* trans-expr.c (gfc_trans_assignment_1): GFC_REVERSE_NOT_SET
changed to GFC_ENABLE_REVERSE.
* trans-array.c (gfc_init_loopinfo): GFC_CANNOT_REVERSE changed
to GFC_INHIBIT_REVERSE.
* gfortran.h : Enum gfc_reverse is now GFC_ENABLE_REVERSE,
GFC_FORWARD_SET, GFC_REVERSE_SET and GFC_INHIBIT_REVERSE.
* dependency.c (gfc_dep_resolver): Change names for elements of
gfc_reverse as necessary. Change the logic so that forward
dependences are remembered as well as backward ones. When both
have appeared, force a temporary.

2011-05-24  Thomas Koenig  

PR fortran/48955
* gfortran.dg/dependency_40.f90 : New test.
Index: gcc/fortran/trans-expr.c
===
*** gcc/fortran/trans-expr.c	(revision 173213)
--- gcc/fortran/trans-expr.c	(working copy)
*** gfc_trans_assignment_1 (gfc_expr * expr1
*** 6069,6076 
/* Calculate the bounds of the scalarization.  */
gfc_conv_ss_startstride (&loop);
/* Enable loop reversal.  */
!   for (n = 0; n < loop.dimen; n++)
! 	loop.reverse[n] = GFC_REVERSE_NOT_SET;
/* Resolve any data dependencies in the statement.  */
gfc_conv_resolve_dependencies (&loop, lss, rss);
/* Setup the scalarizing loops.  */
--- 6069,6076 
/* Calculate the bounds of the scalarization.  */
gfc_conv_ss_startstride (&loop);
/* Enable loop reversal.  */
!   for (n = 0; n < GFC_MAX_DIMENSIONS; n++)
! 	loop.reverse[n] = GFC_ENABLE_REVERSE;
/* Resolve any data dependencies in the statement.  */
gfc_conv_resolve_dependencies (&loop, lss, rss);
/* Setup the scalarizing loops.  */
Index: gcc/fortran/trans-array.c
===
*** gcc/fortran/trans-array.c	(revision 173212)
--- gcc/fortran/trans-array.c	(working copy)
*** gfc_init_loopinfo (gfc_loopinfo * loop)
*** 2244,2250 
for (n = 0; n < GFC_MAX_DIMENSIONS; n++)
  {
loop->order[n] = n;
!   loop->reverse[n] = GFC_CANNOT_REVERSE;
  }
  
loop->ss = gfc_ss_terminator;
--- 2244,2250 
for (n = 0; n < GFC_MAX_DIMENSIONS; n++)
  {
loop->order[n] = n;
!   loop->reverse[n] = GFC_INHIBIT_REVERSE;
  }
  
loop->ss = gfc_ss_terminator;
Index: gcc/fortran/gfortran.h
===
*** gcc/fortran/gfortran.h	(revision 173212)
--- gcc/fortran/gfortran.h	(working copy)
*** gfc_fcoarray;
*** 578,587 
  
  typedef enum
  {
!   GFC_REVERSE_NOT_SET,
GFC_REVERSE_SET,
!   GFC_CAN_REVERSE,
!   GFC_CANNOT_REVERSE
  }
  gfc_reverse;
  
--- 578,587 
  
  typedef enum
  {
!   GFC_ENABLE_REVERSE,
!   GFC_FORWARD_SET,
GFC_REVERSE_SET,
!   GFC_INHIBIT_REVERSE
  }
  gfc_reverse;
  
Index: gcc/fortran/dependency.c
===
*** gcc/fortran/dependency.c	(revision 173212)
--- gcc/fortran/dependency.c	(working copy)
*** gfc_dep_resolver (gfc_ref *lref, gfc_ref
*** 1807,1813 
  
  	  /* Now deal with the loop reversal logic:  This only works on
  		 ranges and is activated by setting
! reverse[n] == GFC_CAN_REVERSE
  		 The ability to reverse or not is set by previous conditions
  		 in this dimension.  If reversal is not activated, the
  		 value GFC_DEP_BACKWARD is reset to GFC_DEP_OVERLAP.  */
--- 1807,1813 
  
  	  /* Now deal with the loop reversal logic:  This only works on
  		 ranges and is activated by setting
! reverse[n] == GFC_ENABLE_REVERSE
  		 The ability to reverse or not is set by previous conditions
  		 in this dimension.  If reversal is not activated, the
  		 value GFC_DEP_BACKWARD is reset to GFC_DEP_OVERLAP.  */
*** gfc_dep_resolver (gfc_ref *lref, gfc_ref
*** 1815,1839 
  		&& lref->u.ar.dimen_type[n] == DIMEN_RANGE)
  		{
  		  /* Set reverse if backward dependence and not inhibited.  */
! 		  if (reverse && reverse[n] != GFC_CANNOT_REVERSE)
  		reverse[n] = (this_dep == GFC_DEP_BACKWARD) ?
  			 GFC_REVERSE_SET : reverse[n];
  
! 		  /* Inhibit loop reversal if dependence not compatible.  */
! 		  if (reverse && reverse[n] != GFC_REVERSE_NOT_SET
! 		&& this_dep != GFC_DEP_EQUAL
! 		&& this_dep != GFC_DE

Re: RFA: patch for PR48757

2011-05-24 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 05/24/11 14:26, Vladimir Makarov wrote:
> The following patch solves PR48757.  It is just a slight modification of
> code for PR48633.
> 
> 2011-05-24  Vladimir Makarov 
> 
> PR rtl-optimization/48757
> * ira-build.c (loop_with_eh_edge_p): Rename to
> loop_with_complex_edge_p, check edges on complexity, make function
> conditional.
> (mark_loops_for_removal): Make call of loop_with_complex_edge_p
> conditional.
> 
> 2011-05-24  Vladimir Makarov 
> 
> PR rtl-optimization/48757
> * gfortran.dg/pr48757.f:  New test case.
> 
> 
> The patch was successfully bootstrapped on x86-64.
> 
> Ok to commit?
OK.
jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJN3CFtAAoJEBRtltQi2kC78q4H+gJNONmi7W0iMY+ff+oHNUq5
nX8JQMvTJaOLKGdEGBDbg3Dtr1KruRB3EBKM4tyq+Wzwn9lzxCppKJwEJt6IVNMh
dAgy7BrhbWaIGDvAGBqqgMZNNh00UCxPpegLs1pmUc4n0jPYigQqYAtDfeg18mWo
ZOurKAy7JiqWgyKzfos1/b9KKmtrYWTEh9HuPn2DWIJIzEDUIqlXvtNuysHDYIja
N8ycs9RASIOMOtelVgQPOnvObrt17CeIdFz4zka81ftUfOaAQEkhft9ijLHYQkGV
R6LrVKUfmZ4myxryy3pu0LN3wZmt74Y87XUGS7kI8ZOTLIA2xkpbd1weh7kyiO8=
=p73P
-END PGP SIGNATURE-


Re: [Solaris] Fix profiling

2011-05-24 Thread Eric Botcazou
> this is PR gcov-profile/48845.

Indeed, I totally missed it.

> On the other hand, the patch is only necessary for tree profiling,
> i.e. with -fprofile-generate, so I'm checking in the following.
>
> Bootstrapped without regressions on i386-pc-solaris2.{[89], 1[01]},
> installed on mainline.

Thanks!

-- 
Eric Botcazou


Re: [testsuite] ignore irrelevant warning in g++.dg/abi/packed1.C

2011-05-24 Thread Janis Johnson
On 05/24/2011 01:40 PM, Mike Stump wrote:
> On May 24, 2011, at 10:41 AM, Janis Johnson wrote:
>> Test g++.dg/abi/packed1.C triggers a warning for several targets.
> 
>> OK for trunk and 4.6?
> 
> Ok.  If there is a portable -Wno-inefficient flag, that'd be a slightly 
> better way to do this.

-Wno-attributes suppresses the warning, I can use that.

Janis


Re: [pph] Various Tree Fields (issue4550064)

2011-05-24 Thread Lawrence Crowl
On 5/20/11, dnovi...@google.com  wrote:
>
> http://codereview.appspot.com/4550064/diff/1/gcc/cp/pph-streamer-in.c
> File gcc/cp/pph-streamer-in.c (right):
>
> http://codereview.appspot.com/4550064/diff/1/gcc/cp/pph-streamer-in.c#newcode251
> gcc/cp/pph-streamer-in.c:251: {
> +static VEC(qualified_typedef_usage_t,gc) *
> +pph_stream_read_qual_use_vec (pph_stream *stream)
> +{
>
> This breaks bootstrap.  This function is never used.  I think you meant
> to call it from the TEMPLATE_INFO handler, right?
>
> Does this look like the right fix?
>
>
> diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
> index d40fd17..c426466 100644
> --- a/gcc/cp/pph-streamer-in.c
> +++ b/gcc/cp/pph-streamer-in.c
> @@ -904,7 +904,7 @@ pph_stream_read_tree (struct lto_input_block *ib
> ATTRIBUTE_UNUSED,
> else if (TREE_CODE (expr) == TEMPLATE_INFO)
>   {
> TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (expr)
> -  = pph_stream_read_tree_vec (stream);
> +  = pph_stream_read_qual_use_vec (stream);
>   }
> else if (TREE_CODE (expr) == TREE_LIST)
>   ; /* FIXME pph: already handled?  */
>
> http://codereview.appspot.com/4550064/
>

LGTM

-- 
Lawrence Crowl


Fix for libobjc/48177. Can I apply it to 4.6 as well ?

2011-05-24 Thread Nicola Pero
This patch fixes libobjc/48177.  I applied it to trunk.

I'd like to apply this patch to the 4.6 branch too.  Do I need permission from 
a Release Manager ?  Can I get it ? :-)

It is a fairly obvious fix as selector types should generally be compared using
sel_types_match() and not strcmp().

But note that this bug has been in libobjc forever; it never mattered much 
because the traditional
API (the only one available before GCC 4.6) had a number of different functions 
for dealing with typed
selectors, and gnustep-base (the main user of this API) was using some other 
function to do this
and the problem wasn't visible.

The modern API (recommended from GCC 4.6.0 onwards) has a more limited, and 
elegant, set of functions,
and the code in gnustep-base would be massively simplified ... if only this bug 
wasn't in the way! :-(

Due to this bug, gnustep-base actually has to forcefully use the traditional 
API in the middle
of the modern API, which it does by copying some declarations from the 
traditional API and
it's all quite horrible.  Ideally, we'd fix this bug in trunk and in 4.6.1, so 
that once 4.6.1
is released, gnustep-base can remove the horrible hacks, simply use the Modern 
API, and just
tell everyone running 4.6.0 to upgrade to 4.6.1 to get the fix. :-)

So, OK to commit to the 4.6 branch too ?

Thanks

Index: libobjc/ChangeLog
===
--- libobjc/ChangeLog   (revision 174141)
+++ libobjc/ChangeLog   (working copy)
@@ -1,3 +1,10 @@
+2011-05-24  Nicola Pero  
+
+   PR libobjc/48177
+   * selector.c (__sel_register_typed_name): Use sel_types_match()
+   instead of strcmp() to compare selector types (Suggestion by
+   Richard Frith-Macdonald ).
+
 2011-04-15  Rainer Orth  
 
PR libobjc/32037
Index: libobjc/selector.c
===
--- libobjc/selector.c  (revision 174138)
+++ libobjc/selector.c  (working copy)
@@ -597,7 +597,7 @@ __sel_register_typed_name (const char *name, const
return s;
}
}
- else if (! strcmp (s->sel_types, types))
+ else if (sel_types_match (s->sel_types, types))
{
  if (orig)
{
Index: gcc/testsuite/ChangeLog
===
--- gcc/testsuite/ChangeLog (revision 174142)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,5 +1,10 @@
 2011-05-24  Nicola Pero  
 
+   PR libobjc/48177
+   * objc.dg/pr48177.m: New testcase.
+
+2011-05-24  Nicola Pero  
+
PR objc/48187
* objc.dg/pr48187.m: New testcase.
* obj-c++.dg/pr48187.mm: New testcase.
Index: gcc/testsuite/objc.dg/pr48177.m
===
--- gcc/testsuite/objc.dg/pr48177.m (revision 0)
+++ gcc/testsuite/objc.dg/pr48177.m (revision 0)
@@ -0,0 +1,35 @@
+/* Contributed by Nicola Pero , May 2011.  */
+/* { dg-do run } */
+/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" 
} { "" } } */
+
+#include 
+#include 
+
+int main(int argc, void **args)
+{
+#ifdef __GNU_LIBOBJC__
+  /* This special test tests that, if you have a selector already
+ registered in the runtime with full type information, you can use
+ sel_registerTypedName() to get it even if you specify the type
+ with incorrect argframe information.  This is helpful as
+ selectors generated by the compiler (which have correct argframe
+ information) are usually registered before hand-written ones
+ (which often have incorrect argframe information, but need the
+ correct one).
+
+ Note that in this hand-written test, even the type information of
+ the first selector may be wrong (on this machine); but that's OK
+ as we'll never actually use the selectors.  */
+  SEL selector1 = sel_registerTypedName ("testMethod", "i8@0:4");
+  SEL selector2 = sel_registerTypedName ("testMethod", "i8@8:8");
+  
+  /* We compare the selectors using ==, not using sel_isEqual().  This
+ is because we are testing internals of the runtime and we know
+ that in the current implementation they should be identical if
+ the stuff is to work as expected.  Don't do this at home.  */
+  if (selector1 != selector2)
+abort ();
+#endif
+
+  return 0;
+}




Re: Go patch committed: Update to current Go library

2011-05-24 Thread Ian Lance Taylor
Rainer Orth  writes:

> 2011-05-20  Rainer Orth  
>
>   libgo:
>   * Makefile.am (go_net_sock_file): Use go/net/cgo_linux.go if
>   LIBGO_IS_IRIX or LIBGO_IS_SOLARIS.
>   (go_net_sock_file): Use go/net/sock_linux.go if
>   LIBGO_IS_IRIX or LIBGO_IS_SOLARIS.
>   * Makefile.in: Regenerate.
>   * go/net/cgo_bsd.go: Don't refer to C.int.

Thanks.

Committed.

Ian


Re: Go patch committed: Update to current Go library

2011-05-24 Thread Ian Lance Taylor
Rainer Orth  writes:

> 2011-05-20  Rainer Orth  
>
>   libgo:
>   * syscalls/socket_irix.go (Addrinfo): Define.
> Declare AI_*, EAI_* constants.

Committed.

Thanks.

Ian


Re: [patch] Fix var-tracking with dynamic stack realignment on x86

2011-05-24 Thread Eric Botcazou
> So, would you like me to redo my patch on top of your patch, test it and
> submit?

I'll take care of that.

> If you think it makes the code clearer, the extra comparison for at most
> each stmt in the prologue_bb is probably noise compile time wise.

No doubt about that.  Plus this may save the next hacker a dozen of minutes 
trying to understand why a seemingly innocuous code movement yields unexpected 
differences in the debug info...

> Fine with me, but I'm not a reviewer of this part of GCC...

Yes, but there is none officially, you wrote the code and the patch only tweaks 
comments and makes a minor code change.  Let's pretend that it's obvious.

Tested on i586-suse-linux, applied on the mainline.  Thanks again.

-- 
Eric Botcazou


Re: Patch ping #2

2011-05-24 Thread Eric Botcazou
> Yes, I mean when -fstack-usage is enabled.  Thus, make
> -fstack-usage -Wframe-larger-than behave the same as
> -fstack-usage -Wstack-usage.  Or do you say that -Wstack-usage
> doesn't require -fstack-usage?

Yes, -Wstack-usage doesn't require -fstack-usage.

> If it doesn't then I hope -Wstack-usage does not have effects on code
> generation?

Neither -fstack-usage nor -Wstack-usage has any effect on code generation.
The former generates a .su file and the latter issues a warning.

> And if not then why can't -Wframe-larger-than just be more precise on some
> targets?   

-Wframe-larger-than is documented to work on any targets and to be imprecise.
So we would need to list the targets for which it is precise (or the targets 
for which it isn't precise) and maintain it.  By contrast, if -Wstack-usage 
returns something, then the answer is always precise.  Moreover I think that 
the common name is a big advantage.

-- 
Eric Botcazou


Re: [Patch, Fortran] -fcoarray=lib - add registering calls for nonallocatable coarrays

2011-05-24 Thread Tobias Burnus
Instead of a ping, an updated patch. This one additionally supports 
registering of nonallocatable coarrays also in MODULE and in BLOCK plus 
a test case.


(Changes to gfc_generate_module_vars and gfc_process_block_locals and 
cgraph call in generate_coarray_init; some functions were moved up in 
the trans-decl.c file.)


OK for the trunk?

Tobias

On 22 May 2011, Tobias Burnus wrote:
The following applies to -fcoarray=lib; for -fcoarray=single there 
should be no change.


The coarray communication library needs to know about the coarrays 
even before the function containing them has been invoked. Thus, the 
coarrays (of all translation units) need to be registered at start up.


This patch handles this by creating a _caf_init function with 
constructor attribute, which is nested in the the parent's procedure 
if the latter contains local nonallocatable (and thus: static/SAVE) 
coarrays variables.


At the same time, all (nonallocatable) coarrays have been turned into 
pointers - to allow the communication library to allocate the memory. 
This allows optimizations, e.g., by allocating in memory which is 
available for all images on the same node (cf. MPI_Alloc_mem).


Additionally, a "token" is saved with the coarray, which allows the 
coarray library to identify the coarray. In a simple implementation, 
it could simply use the base_addr of the coarray or enumerate them 
through.



Example: The small example program

- < test.f90 >-
program caf_program
  integer :: a[*] = 7
  a = 8
end program caf_program
- -

is turned into the following tree (-fdump-tree-original)

- < test.f90.003t.original >-
_caf_init.1 ()
{
  a = (integer(kind=4) * restrict) _gfortran_caf_register (4, 0, 
&caf_token.0, 0B, 0B, 0);

  *a = 7;
}

caf_program ()
{
  static void * caf_token.0;
  static integer(kind=4) * restrict a;
  void _caf_init.1 (void);

  (integer(kind=4)) *a = 8;
}

main (integer(kind=4) argc, character(kind=1) * * argv)
{
  static integer(kind=4) options.2[8] = {68, 1023, 0, 0, 1, 1, 0, 1};

  _gfortran_caf_init (&argc, &argv, &_gfortran_caf_this_image, 
&_gfortran_caf_num_images);

  _gfortran_set_args (argc, argv);
  _gfortran_set_options (8, &options.2[0]);
  _gfortran_caf_sync_all (0B, 0);
  caf_program ();
  __sync_synchronize ();
  _gfortran_caf_finalize ();
  return 0;
}
- -

Note: By construction, _gfortran_caf_register is called before 
_gfortran_caf_init; thus, the MPI library will be initialized by the 
first _gfortran_caf_register call, unless the program does not have 
any nonallocatable coarrays.


No test cases, but the ones in gfortran.dg/coarray/ should already 
test this functionality.


To be done in later patches:
- Coarrays declared in modules (module variables)
- Allocatable coarrays

Note: As constructors are never optimized away [unless they are 
pure/const], static coarrays and also uncalled functions containing 
static coarrays will not be optimized away. (Cf. PRs middle-end/49106 
and middle-end/49108.)


Bootstrapped and regtested on x86-64-linux.
OK for the trunk?

Tobias


2011-05-24  Tobias Burnus  

	PR fortran/18918
	* trans-array.c (gfc_conv_array_ref): Handle pointer coarrays.
	* trans-decl.c (has_coarray_vars, caf_init_block,
	gfor_fndecl_caf_register): New file-global variables.
	(gfc_finish_var_decl): Make sure that coarrays in main are static.
	(gfc_build_qualified_array): Generate coarray token variable.
	(gfc_get_symbol_decl): Don't use a static initializer for coarrays.
	(gfc_build_builtin_function_decls): Set gfor_fndecl_caf_register.
	(gfc_trans_deferred_vars, gfc_emit_parameter_debug_info): Skip for
	static coarrays.
	(generate_local_decl): Check for local coarrays.
	(create_main_function): SYNC ALL before calling MAIN.
	(generate_coarray_sym_init): Register static coarray.
	(generate_coarray_init): Generate CAF registering constructor
	function.
	(gfc_generate_function_code): Call it, if needed, do not create
	cgraph twice.
	(gfc_generate_module_vars, gfc_process_block_locals): Call
	generate_coarray_init.
	* trans-types.c (gfc_get_nodesc_array_type): Generate pointers for
	-fcoarray=lib.
	* trans.h (gfor_fndecl_caf_register): New variable.
	(lang_type): New element caf_token.
	(GFC_TYPE_ARRAY_CAF_TOKEN): New macro.

2011-05-22  Tobias Burnus  

	PR fortran/18918
	* gfortran.dg/coarray/registering_1.f90: New.

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 78d65a6..29c7f83 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2623,6 +2623,10 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym,
   if (ar->dimen == 0)
 {
   gcc_assert (ar->codimen);
+  if (GFC_ARRAY_TYPE_P (TREE_TYPE (se->expr))
+	  && TREE_CODE (TREE_TYPE (se->expr)) == POINTER_TYPE)
+	se->expr = build_fold_indirect_ref_loc (input_location, se->expr);
+
   /* Use the actual tree type and not the wrapped coa

Re: Go patch committed: Update to current Go library

2011-05-24 Thread Ian Lance Taylor
Rainer Orth  writes:

> One needs to check for putenv vs. setenv and handle that in
> go-setenv.c.  I've hacked around the issue for the moment to at least
> let bootstrap succeed.

I fixed this problem like so.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 42dfe9ab0c96 libgo/configure.ac
--- a/libgo/configure.ac	Tue May 24 14:44:49 2011 -0700
+++ b/libgo/configure.ac	Tue May 24 15:01:29 2011 -0700
@@ -431,7 +431,7 @@
 AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h)
 AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
 
-AC_CHECK_FUNCS(srandom random strerror_r strsignal wait4 mincore)
+AC_CHECK_FUNCS(srandom random strerror_r strsignal wait4 mincore setenv)
 AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
 AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
 
diff -r 42dfe9ab0c96 libgo/runtime/go-setenv.c
--- a/libgo/runtime/go-setenv.c	Tue May 24 14:44:49 2011 -0700
+++ b/libgo/runtime/go-setenv.c	Tue May 24 15:01:29 2011 -0700
@@ -4,6 +4,8 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.  */
 
+#include "config.h"
+
 #include 
 #include 
 
@@ -25,24 +27,38 @@
 
   ks = k.__data;
   kn = NULL;
+  vs = v.__data;
+  vn = NULL;
+
+#ifdef HAVE_SETENV
+
   if (ks[k.__length] != 0)
 {
   kn = __go_alloc (k.__length + 1);
-  __builtin_memcpy (kn, k.__data, k.__length);
+  __builtin_memcpy (kn, ks, k.__length);
   ks = kn;
 }
 
-  vs = v.__data;
-  vn = NULL;
   if (vs[v.__length] != 0)
 {
   vn = __go_alloc (v.__length + 1);
-  __builtin_memcpy (vn, v.__data, v.__length);
+  __builtin_memcpy (vn, vs, v.__length);
   vs = vn;
 }
 
   setenv ((const char *) ks, (const char *) vs, 1);
 
+#else /* !defined(HAVE_SETENV) */
+
+  kn = malloc (k.__length + v.__length + 2);
+  __builtin_memcpy (kn, ks, k.__length);
+  kn[k.__length] = '=';
+  __builtin_memcpy (kn + k.__length + 1, vs, v.__length);
+  kn[k.__length + v.__length + 1] = '\0';
+  putenv ((char *) kn);
+
+#endif /* !defined(HAVE_SETENV) */
+
   if (kn != NULL)
 __go_free (kn);
   if (vn != NULL)


Create common hooks structure shared between driver and cc1

2011-05-24 Thread Joseph S. Myers
This patch implements a target hooks structure for hooks shared
between the driver and the core compilers.  Such hooks go in
libcommon-target.a which is then linked into the relevant binaries.
ALWAYS_STRIP_DOTDOT is converted to a hook as the initial hook for the
new structure.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Also
tested building cc1 and xgcc for cross to hppa2.0w-hp-hpux11.23
(pa/som.h was the only header defining ALWAYS_STRIP_DOTDOT; note that
pa/t-pa previously was not used by any target, hence the complete
replacement of its contents).  OK to commit?

The general structure for these hooks is as described in
, the
description of the patch that separated the C-family hooks structure
more cleanly from the main hooks.  In particular, the common/ and
common/config/ directories are used as described there.  I don't plan
to work on moving "common" files to the common/ directory but would
certainly encourage people to do so (and likewise to set up the
driver/ directory); files that should move include the sources of
libcommon.a and libcommon-target.a, and opts.c and params.c (which
will end up being used in libcommon-target.a), and *most* of the
headers used by those files.

(flags.h is a mess and should not I think be considered common; some
declarations should perhaps move to opts.h or tree.h.  The
SWITCHABLE_TARGET bits of flags.h, in particular, represent a hidden
dependency on tm.h (if tm.h isn't included first, flags.h will quietly
produce the wrong declarations), and a reason the header should not be
included in common or driver code; while cc1-only code generally uses
flags.h instead of options.h, maybe options.h should actually be more
widely used instead and flags.h should #error if used without tm.h.
coretypes.h isn't strictly common - many types defined there should
properly only be visible in the core compilers - but I think can
reasonably be treated as common initially.)

I *do* plan to move all the target hooks used in opts.c to the new
structure.

The following target macros used in both the driver (including cc1)
and the core compilers should I think end up in the new structure
(some are currently used in code built for the target so would need
extra work arranging for the compiler to predefine macros based on
them if -fbuilding-libgcc): NAME__MAIN NEXT_OBJC_RUNTIME
NO_DOLLAR_IN_LABEL NO_DOT_IN_LABEL STANDARD_EXEC_PREFIX
TARGET_EXECUTABLE_SUFFIX TARGET_OBJECT_SUFFIX USER_LABEL_PREFIX.  The
same applies to the following macros used in opts.c:
DEFAULT_GDB_EXTENSIONS DEFAULT_SIGNED_CHAR STACK_CHECK_BUILTIN
STACK_CHECK_STATIC_BUILTIN.  TARGET_64BIT is a special case that is
wrongly used in target-independent code but should be private to
particular ports.

The following target macros are used in both the driver and the core
compilers, but probably can't become hooks because of the ways they
are used: DBX_DEBUGGING_INFO DWARF2_DEBUGGING_INFO
PREFERRED_DEBUGGING_TYPE XCOFF_DEBUGGING_INFO.  Making them into
configure-defined macros (with different names for the sake of
poisoning) is probably appropriate; they are set by logic based on
combinations of target cases in config.gcc, configure options to
select particular formats that contribute entries to tm_file, and
toplevel configure.ac code(!)  that defaults --with-stabs on for
certain targets, and much simpler logic is probably appropriate in
practice (i.e. first follow configure options, failing that default to
DWARF2 except for a list of targets deliberately choosing other
formats, and similarly control what set of formats have support built
in).


2011-05-24  Joseph Myers  

* common/common-target-def.h, common/common-target.def,
common/common-target.h, common/config/default-common.c,
common/config/pa/pa-common.c: New files.
* Makefile.in (EXTRA_COMMON_OBJS, COMMON_TARGET_DEF,
COMMON_TARGET_H, COMMON_TARGET_DEF_H): New.
(OBJS-libcommon-target): Include $(EXTRA_COMMON_OBJS).
(prefix.o): Update dependencies.
(default-common.o, common/common-target-hooks-def.h,
s-common-target-hooks-def-h): New.
(s-tm-texi): Also check timestamp on common-target.def.
(build/genhooks.o): Update dependencies.
* config.gcc (extra_common_objs, target_has_targetm_common):
Define.
(hppa*-*-*): Add pa/t-pa to tmake_file.
* config/pa/som.h (ALWAYS_STRIP_DOTDOT): Replace with
TARGET_ALWAYS_STRIP_DOTDOT.
* config/pa/t-pa: Remove previous contents.
(pa-common.o): New.
* configure.ac (extra_common_objs): Substitute.
(common): Create directory.
* configure: Regenerate.
* doc/tm.texi.in (targetm_common): Document.
(TARGET_ALWAYS_STRIP_DOTDOT): Add @hook entry.
* doc/tm.texi: Regenerate.
* genhooks.c (hook_array): Also include common/common-target.def.
* prefix.c (tm.h): Don't include.

[SPARC] Disable -fira-share-save-slots by default

2011-05-24 Thread Eric Botcazou
The new save slot sharing algorithm has a documented limitation:

   Future work:

 In the fallback case we should iterate backwards across all possible
 modes for the save, choosing the largest available one instead of
 falling back to the smallest mode immediately.  (eg TF -> DF -> SF).

that is annoying for the SPARC when it comes to floating-point code because the 
floating-point registers are single (SF) but there is a fully-fledged support 
for double (DF) arithmetics in the architecture.  So saving registers on an 
individual basis really pessimizes here.  For example, the size of the object 
generated for the Ada unit a-nlcefu.ads at -O2 decreases from 96080 to 95088 
bytes when you pass -fno-ira-share-save-slots.

Experiments have shown that the impact on integer code is null in terms of code 
size and negligible in terms of stack usage (-fstack-usage reports 8/16 bytes 
increase for most functions).  Therefore this patch disables the option by 
default for the SPARC.  Boostrapped/regtested on SPARC/Solaris, applied on the 
mainline and 4.6 branch.


Jeff, I'd like to apply it to the 4.5 branch as well, but I need your patch:

2011-01-21  Jeff Law  

PR rtl-optimization/41619
* caller-save.c (setup_save_areas): Break out code to determine
which hard regs are live across calls by examining the reload chains
so that it is always used.
Eliminate code which checked REG_N_CALLS_CROSSED.

Do you have any objections to me backporting it to the branch?


2011-05-24  Eric Botcazou  

* config/sparc/sparc.c (sparc_option_override): If not set by the user,
force flag_ira_share_save_slots to 0.


-- 
Eric Botcazou
Index: config/sparc/sparc.c
===
--- config/sparc/sparc.c	(revision 174058)
+++ config/sparc/sparc.c	(working copy)
@@ -933,6 +933,12 @@ sparc_option_override (void)
 			  ? 64 : 32),
 			 global_options.x_param_values,
 			 global_options_set.x_param_values);
+
+  /* Disable save slot sharing for call-clobbered registers by default.
+ The IRA sharing algorithm works on single registers only and this
+ pessimizes for double floating-point registers.  */
+  if (!global_options_set.x_flag_ira_share_save_slots)
+flag_ira_share_save_slots = 0;
 }
 
 /* Miscellaneous utilities.  */


[C++ PATCH] Fix -fdump-tree-all with C++

2011-05-24 Thread Jakub Jelinek
Hi!

The recent Nathan's change apparently broke -fdump-tree-all,
in particular I see ICEs when running -fdump-tree-all on the
PR49144 testcase.
The problem is that CTOR_INITIALIZER is tcc_expression, and while it is
built with build_min_nt, when dumping *.tu TREE_TYPE is used on all
expr codes.

tree_exp contains tree_typed, so IMHO we should just say it has the type
too.

Ok for trunk?

2011-05-25  Jakub Jelinek  

* cp-objcp-common.c (cp_common_init_ts): Mark CTOR_INITIALIZER
as TS_TYPED.

--- gcc/cp/cp-objcp-common.c.jj 2011-05-11 19:38:52.0 +0200
+++ gcc/cp/cp-objcp-common.c2011-05-25 00:17:19.0 +0200
@@ -297,6 +297,7 @@ cp_common_init_ts (void)
   MARK_TS_TYPED (VEC_INIT_EXPR);
   MARK_TS_TYPED (USING_STMT);
   MARK_TS_TYPED (LAMBDA_EXPR);
+  MARK_TS_TYPED (CTOR_INITIALIZER);
 }
 
 #include "gt-cp-cp-objcp-common.h"

Jakub


Re: [testsuite] ignore irrelevant warning in two ARM tests

2011-05-24 Thread Joseph S. Myers
On Tue, 24 May 2011, Janis Johnson wrote:

> On 05/24/2011 12:40 PM, Joseph S. Myers wrote:
> > On Tue, 24 May 2011, Janis Johnson wrote:
> > 
> >> On ARM, two g++ tests trigger a warning about changed mangling.  The
> >> warning is not relevant to the purpose of the test, so this patch
> >> causes it to be ignored.
> > 
> > Various existing tests use -Wno-abi or -Wno-psabi on particular targets 
> > for such cases.  E.g.
> > 
> > // { dg-options "-Wno-abi" { target arm_eabi } }
> > 
> 
> Is this one OK for trunk and 4.6?  The failure occurs for arm-none-eabi
> and for arm-none-linux-gnueabi.

You should repeat all the original options from the main dg-options line, 
with -Wno-abi added, in the ARM EABI dg-options line, since only one 
dg-options line will be in effect.

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


Re: [testsuite] ignore irrelevant warning in two ARM tests

2011-05-24 Thread Janis Johnson
On 05/24/2011 03:33 PM, Joseph S. Myers wrote:
> On Tue, 24 May 2011, Janis Johnson wrote:
> 
>> On 05/24/2011 12:40 PM, Joseph S. Myers wrote:
>>> On Tue, 24 May 2011, Janis Johnson wrote:
>>>
 On ARM, two g++ tests trigger a warning about changed mangling.  The
 warning is not relevant to the purpose of the test, so this patch
 causes it to be ignored.
>>>
>>> Various existing tests use -Wno-abi or -Wno-psabi on particular targets 
>>> for such cases.  E.g.
>>>
>>> // { dg-options "-Wno-abi" { target arm_eabi } }
>>>
>>
>> Is this one OK for trunk and 4.6?  The failure occurs for arm-none-eabi
>> and for arm-none-linux-gnueabi.
> 
> You should repeat all the original options from the main dg-options line, 
> with -Wno-abi added, in the ARM EABI dg-options line, since only one 
> dg-options line will be in effect.

Oops, yet again.  I'll do that.

Janis



[v3] libstdc++/49151

2011-05-24 Thread Paolo Carlini

Hi,

straightforward implementation of the resolution + some missing 
constexpr specifiers.


Tested x86_64-linux, committed.

Paolo.


2011-05-24  Paolo Carlini  

PR libstdc++/49151
* include/std/chrono (operator+, operator-, operator*, operator/,
operator&): Implement LWG 2020 [WP]; specify constexpr.
* testsuite/20_util/duration/arithmetic/dr2020.cc: New.
Index: include/std/chrono
===
--- include/std/chrono  (revision 174124)
+++ include/std/chrono  (working copy)
@@ -352,28 +352,28 @@
 
 template
-  inline typename common_type,
- duration<_Rep2, _Period2>>::type
+  inline constexpr typename common_type,
+   duration<_Rep2, _Period2>>::type
   operator+(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
   {
typedef duration<_Rep1, _Period1>   __dur1;
typedef duration<_Rep2, _Period2>   __dur2;
-   typedef typename common_type<__dur1,__dur2>::type   __ct;
-   return __ct(__lhs) += __rhs;
+   typedef typename common_type<__dur1,__dur2>::type   __cd;
+   return __cd(__cd(__lhs).count() + __cd(__rhs).count());
   }
 
 template
-  inline typename common_type,
- duration<_Rep2, _Period2>>::type
+  inline constexpr typename common_type,
+   duration<_Rep2, _Period2>>::type
   operator-(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
   {
typedef duration<_Rep1, _Period1>   __dur1;
typedef duration<_Rep2, _Period2>   __dur2;
-   typedef typename common_type<__dur1,__dur2>::type   __ct;
-   return __ct(__lhs) -= __rhs;
+   typedef typename common_type<__dur1,__dur2>::type   __cd;
+   return __cd(__cd(__lhs).count() - __cd(__rhs).count());
   }
 
 template::type type; };
 
 template
-  inline duration::type, _Period>
+  inline constexpr
+  duration::type, _Period>
   operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
   {
-   typedef typename common_type<_Rep1, _Rep2>::type__cr;
-   return duration<__cr, _Period>(__d) *= __s;
+   typedef duration::type, _Period>
+ __cd;
+   return __cd(__cd(__d).count() * __s);
   }
 
 template
-  inline duration::type, _Period>
+  inline constexpr
+  duration::type, _Period>
   operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
   { return __d * __s; }
 
 template
-  inline duration::value, _Rep2>::type>::type, _Period>
   operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
   {
-   typedef typename common_type<_Rep1, _Rep2>::type__cr;
-   return duration<__cr, _Period>(__d) /= __s;
+   typedef duration::type, _Period>
+ __cd;
+   return __cd(__cd(__d).count() / __s);
   }
 
  template
-  inline typename common_type<_Rep1, _Rep2>::type
+  inline constexpr typename common_type<_Rep1, _Rep2>::type
   operator/(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
   {
typedef duration<_Rep1, _Period1>   __dur1;
typedef duration<_Rep2, _Period2>   __dur2;
-   typedef typename common_type<__dur1,__dur2>::type   __ct;
-   return __ct(__lhs).count() / __ct(__rhs).count();
+   typedef typename common_type<__dur1,__dur2>::type   __cd;
+   return __cd(__lhs).count() / __cd(__rhs).count();
   }
 
 // DR 934.
 template
-  inline duration::value, _Rep2>::type>::type, _Period>
   operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
   {
-   typedef typename common_type<_Rep1, _Rep2>::type__cr;
-   return duration<__cr, _Period>(__d) %= __s;
+   typedef duration::type, _Period>
+ __cd;
+   return __cd(__cd(__d).count() % __s);
   }
 
  template
-  inline typename common_type,
- duration<_Rep2, _Period2>>::type
+  inline constexpr typename common_type,
+   duration<_Rep2, _Period2>>::type
   operator%(const duration<_Rep1, _Period1>& __lhs,
const duration<_Rep2, _Period2>& __rhs)
   {
typedef duration<_Rep1, _Period1>   __dur1;
typedef duration<_Rep2, _Period2>   __dur2;
-   typedef typename common_type<__dur1,__dur2>::type   __ct;
-   return __ct(__lhs) %= __rhs;
+   typedef typename common_type<__dur1,__dur2>::type   __cd;
+   return __cd(__cd(__lhs).count() % __cd(_

C++ PATCH for c++/49042 (another acccess/templates issue)

2011-05-24 Thread Jason Merrill
...except we hit this one in mangling rather than deduction.  There was 
already code here to suppress access control here, but it doesn't work 
anymore, since flag_access_control is now only checked at the beginning 
of compilation.  The fix is to use push_deferring_access_checks instead.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit b59f44587a32d3ff68d0dedac8f82df1f299cfd0
Author: Jason Merrill 
Date:   Tue May 24 16:48:02 2011 -0400

	PR c++/49042
	* pt.c (get_mostly_instantiated_function_type): Use
	push_deferring_access_checks rather than set flag_access_control.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 98844c3..bd9aeba 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18045,7 +18045,7 @@ get_mostly_instantiated_function_type (tree decl)
 ;
   else
 {
-  int i, save_access_control;
+  int i;
   tree partial_args;
 
   /* Replace the innermost level of the TARGS with NULL_TREEs to
@@ -18060,8 +18060,7 @@ get_mostly_instantiated_function_type (tree decl)
 
   /* Disable access control as this function is used only during
 	 name-mangling.  */
-  save_access_control = flag_access_control;
-  flag_access_control = 0;
+  push_deferring_access_checks (dk_no_check);
 
   ++processing_template_decl;
   /* Now, do the (partial) substitution to figure out the
@@ -18076,7 +18075,7 @@ get_mostly_instantiated_function_type (tree decl)
   TREE_VEC_LENGTH (partial_args)--;
   tparms = tsubst_template_parms (tparms, partial_args, tf_error);
 
-  flag_access_control = save_access_control;
+  pop_deferring_access_checks ();
 }
 
   return fn_type;
diff --git a/gcc/testsuite/g++.dg/cpp0x/access01.C b/gcc/testsuite/g++.dg/cpp0x/access01.C
new file mode 100644
index 000..43e5e86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/access01.C
@@ -0,0 +1,15 @@
+// PR c++/49042
+// { dg-options -std=c++0x }
+
+template 
+class A
+{
+  T p;
+public:
+  template  auto f() -> decltype(+p) { }
+};
+
+int main()
+{
+  A().f();
+}


Re: [C++ PATCH] Fix -fdump-tree-all with C++

2011-05-24 Thread Jason Merrill

OK.

Jason


Re: [testsuite] remove arm from xfail list for g++.dg/other/packed1.C

2011-05-24 Thread Mike Stump
On May 24, 2011, at 12:24 PM, Janis Johnson wrote:
> All archived test results for ARM for 4.7.0 and 4.6.1 with g++
> results include:
> 
> XPASS: g++.dg/other/packed1.C execution test
> 
> This patch removes arm-*-* from the xfail list for this test.  OK for
> trunk and 4.6?

Ok.


Re: [testsuite] remove XFAIL for all but ia64 for g++.dg/tree-ssa/pr43411.C

2011-05-24 Thread Mike Stump
On May 24, 2011, at 12:23 PM, Janis Johnson wrote:
> Archived test results for 4.7.0 for most processors with C++ results have:
> 
> XPASS: g++.dg/tree-ssa/pr43411.C scan-tree-dump-not optimized "OBJ_TYPE_REF"
> 
> The only failures I could find were for ia64-linux and ia64-hpux.  This
> patch changes the xfail so it only applies to ia64-*-*.  OK for trunk?

Ok.


Re: RFA: patch to fix PR48971

2011-05-24 Thread Hans-Peter Nilsson
On Fri, 13 May 2011, Vladimir Makarov wrote:
> The following patch solves the problem described on
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48971
>
> The patch was successfully bootstrapped on x86-64 and checked for ppc64, ia64,
> i686-linux, i686-apple-darwin, mips, arm, s390x, and sparc with and without
> -msoft-float.
>
> Is it ok to submit to the trunk?
>
> 2011-05-13  Vladimir Makarov 
>
> PR rtl-optimization/48971
> * ira.c (setup_pressure_classes): Don't check register move cost
> for classes with one registers.  Don't add pressure class if there
> is a pressure class with the same available hard registers.
> Check contains_reg_of_mode.  Fix a typo in collecting
> temp_hard_regset.  Ignore hard registers not belonging to a class.
>

It seems this broke cris-elf: PR49154.

brgds, H-P


Re: The TI C6X port

2011-05-24 Thread Vladimir Makarov

On 11-05-23 5:45 AM, Bernd Schmidt wrote:

Ping: C6X scheduler changes.

http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00747.html
I think it is ok.  I spent a lot of time looking at the change.  It 
looks ok to me although it is hard to be sure because the code is too 
complicated.  So it is good thing that you are trying to simplify it.

http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00749.html

Ok.

http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00750.html

Ok.  But changelog entry for sched_change_pattern is absent.

http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00753.html

It is a really big patch.  I need more time to look at it.

http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00755.html


Ok. Only changelog entry for deps_analyze_insn is missed.

So I need to finish review of the 4th patch (I hope to finish it 
tomorrow).  All other patches is ok.

Thanks for the patches, Bernd.



Re: RFA: patch to fix PR48971

2011-05-24 Thread Vladimir Makarov

On 11-05-24 8:24 PM, Hans-Peter Nilsson wrote:

On Fri, 13 May 2011, Vladimir Makarov wrote:

The following patch solves the problem described on
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48971

The patch was successfully bootstrapped on x86-64 and checked for ppc64, ia64,
i686-linux, i686-apple-darwin, mips, arm, s390x, and sparc with and without
-msoft-float.

Is it ok to submit to the trunk?

2011-05-13  Vladimir Makarov

 PR rtl-optimization/48971
 * ira.c (setup_pressure_classes): Don't check register move cost
 for classes with one registers.  Don't add pressure class if there
 is a pressure class with the same available hard registers.
 Check contains_reg_of_mode.  Fix a typo in collecting
 temp_hard_regset.  Ignore hard registers not belonging to a class.


It seems this broke cris-elf: PR49154.
Thanks for reporting this.  It was a very sensitive change therefore I 
checked so many targets (about 10) but apparently not all of them.  I'll 
look at the CRIS problem tomorrow.




  1   2   >