Re: [lto, testsuite] Don't use visibility on targets that don't support it (PR lto/47334)

2011-06-09 Thread Rainer Orth
Mike Stump  writes:

> On Apr 5, 2011, at 1:56 AM, Rainer Orth wrote:
>>  * lto.c (promote_var): Only set VISIBILITY_HIDDEN if
>>  HAVE_GAS_HIDDEN.
>
> This looks wrong, there are more things that have visibility than those 
> things that use GAS and have .hidden.  Darwin I think is one of them.  ?  
> cygming.h seems to be another.

Now that Darwin has been switched to define HAVE_GAS_HIDDEN, is the
lto.c part ok?

I've re-bootstrapped both patches together on i386-apple-darwin9.8.0,
powerpc-apple-darwin9.8.0, i386-pc-solaris2.8 and i386-pc-solaris2.11
without regressions; as expected the failure on Solaris 8/x86 is gone.

Thanks.
Rainer

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


[Patch : H8300] Bug fix for bit insn and minor tweaks to insns

2011-06-09 Thread Kaushik Phatak
Hi,
The following patch fixes an ICE that is generated when the compiler tries
to perform bit manipulation for logical operations when the source and 
destination address does not match. The testcase is also included in the 
patch(gcc.dg).
The additional condition in the insn takes care of the ICE which occurs at 
'-O1'.
The other insn's are reordered to give preference to bit instructions using 
existing
constraints.
Ok to apply?

Thanks & Regards,
Kaushik Phatak
www.kpitgnutools.com

2011-06-09  Kaushik Phatak 

* config/h8300/h8300.md (bsetqi_msx, bclrqi_msx, bnotqi_msx): Added 
condition to disallow non-identical memory locations.
(*andqi3_2, andqi3_1, iorqi3_1, xorqi3_1): Reorder insn to give
preference to bit manipulation instructions.
* gcc.dg/h8300-bit-insn-ice2.2: New testcase.



h8_bit.diff
Description: h8_bit.diff


Re: toplevel libgcc md-unwind-support.h change breaks build

2011-06-09 Thread Rainer Orth
David Miller  writes:

> It's using "linux.h" instead of "linux-unwind.h" for whatever reason.
>
> So we need something like this?
>
> diff --git a/libgcc/config.host b/libgcc/config.host
> index 24282e1..713b2a9 100644
> --- a/libgcc/config.host
> +++ b/libgcc/config.host
> @@ -600,7 +600,7 @@ sparc-*-elf*)
>  sparc-*-linux*)  # SPARC's running GNU/Linux, libc6
>   extra_parts="$extra_parts crtfastmath.o"
>   tmake_file="${tmake_file} t-crtfm"
> - md_unwind_header=sparc/linux.h
> + md_unwind_header=sparc/linux-unwind.h
>   ;;
>  sparc-*-rtems* | sparc64-*-rtems* )
>   tmake_file="sparc/t-elf t-crtin t-crtfm t-rtems"

Of course we do.  I must have been dreaming when writing parts of this
patch.  I've now double-checked all md_unwind_header filenames, found
just another typo, and installed the following as obvious.

Sorry for the mess.

Rainer


2011-06-09  David S. Miller  
Rainer Orth  

* config.host (sparc-*-linux*): Correct md_unwind_header
filename.
(s390x-ibm-tpf*): Fix typo.

Index: libgcc/config.host
===
--- libgcc/config.host  (revision 174837)
+++ libgcc/config.host  (working copy)
@@ -563,7 +563,7 @@
;;
 s390x-ibm-tpf*)
tmake_file="${tmake_file} s390/t-crtstuff s390/t-tpf"
-   md_unwind_header-s390/tpf-unwind.h
+   md_unwind_header=s390/tpf-unwind.h
;;
 score-*-elf)
 ;;
@@ -600,7 +600,7 @@
 sparc-*-linux*)# SPARC's running GNU/Linux, libc6
extra_parts="$extra_parts crtfastmath.o"
tmake_file="${tmake_file} t-crtfm"
-   md_unwind_header=sparc/linux.h
+   md_unwind_header=sparc/linux-unwind.h
;;
 sparc-*-rtems* | sparc64-*-rtems* )
tmake_file="sparc/t-elf t-crtin t-crtfm t-rtems"

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


Re: toplevel libgcc md-unwind-support.h change breaks build

2011-06-09 Thread David Miller
From: Rainer Orth 
Date: Thu, 09 Jun 2011 09:33:35 +0200

> Of course we do.  I must have been dreaming when writing parts of this
> patch.  I've now double-checked all md_unwind_header filenames, found
> just another typo, and installed the following as obvious.

Thanks.


Re: [build] Move ENABLE_EXECUTE_STACK to toplevel libgcc

2011-06-09 Thread Rainer Orth
"Joseph S. Myers"  writes:

> On Tue, 7 Jun 2011, Rainer Orth wrote:
>
>> > So my view is that you should define __LIBGCC_TRAMPOLINE_SIZE__, only if 
>> > -fbuilding-libgcc.
>> 
>> I can give it a try if I can figure out how to define -fbuilding-libgcc
>> via the option handling machinery.  I just want to avoid having to
>
> That should be no more than
>
> ; Define extra predefined macros for use in libgcc.
> fbuilding-libgcc
> C ObjC C++ ObjC++ Undocumented Var(flag_building_libgcc)
>
> in c.opt.

Indeed, that did the trick.  The following revised patch has been
bootstrapped without regressions on i386-pc-solaris2.10.  I've already
got build, Darwin and Mingw approval and can commit the osf and solaris
parts on my own.  If the C parts are ok now, I suppose I still need
approval either from the various *BSD maintainers (who haven't chimed in
yet) of from a global reviewer?

Thanks.
Rainer


2011-05-29  Rainer Orth  
Joseph Myers  

gcc:
* config/alpha/netbsd.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/alpha/osf5.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/darwin.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/i386/mingw32.h (MINGW_ENABLE_EXECUTE_STACK): Remove.
(ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
[IN_LIBGCC2]: Don't include .
* config/i386/netbsd-elf.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/i386/netbsd64.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/netbsd.h (NETBSD_ENABLE_EXECUTE_STACK): Remove.
* config/openbsd.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/sol2.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/sparc/freebsd.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/sparc/netbsd-elf.h (ENABLE_EXECUTE_STACK): Remove.
(HAVE_ENABLE_EXECUTE_STACK): Define.
* config/alpha/alpha.c (alpha_trampoline_init): Test
HAVE_ENABLE_EXECUTE_STACK.
* config/i386/i386.c (ix86_trampoline_init): Likewise.
* config/sparc/sparc.c (sparc32_initialize_trampoline): Likewise.
(sparc64_initialize_trampoline): Likewise.
* libgcc2.c [L_enable_execute_stack]: Remove.
* system.h (ENABLE_EXECUTE_STACK): Poison.
* doc/tm.texi.in (Trampolines, ENABLE_EXECUTE_STACK): Remove.
* doc/tm.texi: Regenerate.
* Makefile.in (LIBGCC2_CFLAGS): Add -fbuilding-libgcc.

gcc/c-family:
* c.opt (fbuilding-libgcc): New option.
* c-cppbuiltin.c (c_cpp_builtins): Define
__LIBGCC_TRAMPOLINE_SIZE__ if flag_building_libgcc.

libgcc:
* enable-execute-stack-empty.c: New file.
* enable-execute-stack-mprotect.c: New file.
* config/i386/enable-execute-stack-mingw32.c: New file.
* config.host (enable_execute_stack): New variable.
Select appropriate variants.
* configure.ac: Link enable-execute-stack.c to
$enable_execute_stack.
* configure: Regenerate.
* Makefile.in (LIB2ADD): Add enable-execute-stack.c.
(lib2funcs): Remove _enable_execute_stack.

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -722,7 +722,7 @@ LIBGCC2_DEBUG_CFLAGS = -g
 LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) 
$(TARGET_LIBGCC2_CFLAGS) \
 $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \
 -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
--fno-stack-protector \
+-fbuilding-libgcc -fno-stack-protector \
 $(INHIBIT_LIBC_CFLAGS)
 
 # Additional options to use when compiling libgcc2.a.
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1,5 +1,5 @@
 /* Define builtin-in macros for the C family front ends.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -727,6 +727,12 @@ c_cpp_builtins (cpp_reader *pfile)
   builtin_define_fixed_point_constants ("UTA", "", uta_type_node);
 }
 
+  /* For libgcc-internal use only.  */
+  if (flag_building_libgcc)
+/* For libgcc enable-execute-stack.c.  */
+builtin_define_with_int_value ("__LIBGCC_TRAMPOLINE_SIZE__",
+  TRAMPOLINE_SIZE);
+
   /* For use in assembly language.  */
   builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
   builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
diff --git a/gcc/c

Re: [PATCH] Fix ICE in reset_unmarked_insns_debug_uses (PR middle-end/49308)

2011-06-09 Thread Jakub Jelinek
On Tue, Jun 07, 2011 at 02:24:49PM +0200, Jakub Jelinek wrote:
> Fixed thusly.  Additionally I've renamed a variable that was shadowing
> a variable of the same name, which confused me quite a bit when debugging
> it - I was expecting insn to be a DEBUG_INSN, while it was something
> completely different.
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Alex said on IRC this looks obvious to him and I agree, so I've installed
it to trunk as such.

> 2011-06-07  Jakub Jelinek  
> 
>   PR middle-end/49308
>   * dce.c (reset_unmarked_insns_debug_uses): Avoid shadowing insn
>   variable.  After resetting and rescanning insn continue with previous
>   statement.
> 
>   * gfortran.dg/pr49308.f90: New test.
> 
> --- gcc/dce.c.jj  2011-06-06 19:07:08.0 +0200
> +++ gcc/dce.c 2011-06-07 11:08:12.0 +0200
> @@ -514,11 +514,11 @@ reset_unmarked_insns_debug_uses (void)
> struct df_link *defs;
> for (defs = DF_REF_CHAIN (use); defs; defs = defs->next)
>   {
> -   rtx insn;
> +   rtx ref_insn;
> if (DF_REF_IS_ARTIFICIAL (defs->ref))
>   continue;
> -   insn = DF_REF_INSN (defs->ref);
> -   if (!marked_insn_p (insn))
> +   ref_insn = DF_REF_INSN (defs->ref);
> +   if (!marked_insn_p (ref_insn))
>   break;
>   }
> if (!defs)
> @@ -527,6 +527,7 @@ reset_unmarked_insns_debug_uses (void)
>each of the DEFs?  */
> INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC ();
> df_insn_rescan_debug_internal (insn);
> +   break;
>   }
>   }
>  }
> --- gcc/testsuite/gfortran.dg/pr49308.f90.jj  2011-06-07 11:39:39.0 
> +0200
> +++ gcc/testsuite/gfortran.dg/pr49308.f90 2011-06-07 11:30:25.0 
> +0200
> @@ -0,0 +1,28 @@
> +! PR middle-end/49308
> +! { dg-do compile }
> +! { dg-options "-O2 -funroll-loops -g" }
> +
> +subroutine foo(n, b, d, e)
> +  type t
> +integer :: f
> +  end type t
> +  type s
> +type(t), pointer :: g
> +  end type s
> +  type u
> +type(s), dimension(:), pointer :: h
> +  end type
> +  integer :: i, k, n
> +  type(u), pointer :: a, e
> +  character(len=250) :: b, c, d
> +  logical :: l
> +  do i = 1, n
> +j = i - 1
> +if (j/=0) c = trim(b) // adjustl(d(j))
> +  end do
> +  a => e
> +  do k = 1, size(a%h)
> + l = (a%h(k)%g%f == a%h(1)%g%f)
> + if (.not.(l)) call bar()
> +  enddo
> +end subroutine foo

Jakub


Re: C++ PATCH for c++/49107 (excessive instantiation due to noexcept)

2011-06-09 Thread Paolo Carlini

On 06/08/2011 11:32 PM, Jason Merrill wrote:
49107 is an issue with the addition of noexcept to the standard 
library causing extra instantiations, to the point that code that 
worked before doesn't work now due to circular dependency.  Someone 
suggested that to avoid this problem we could defer instantiation of 
noexcept-specifiers until they are actually needed.  This patch 
implements that suggestion, and does in fact seem to fix the problem.

Thanks a lot Jason.

I'm trying to figure out which are the implications for the library of 
the comment you added to c++/48468, I think it would be now more 
difficult to implement consolidated is_nothrow_* traits, thus not 
computing first via sfinae the corresponding is_* trait. But doesn't 
seem a serious limitation...


Thanks again,
Paolo.


[v3] Fix two typos in

2011-06-09 Thread Paolo Carlini

Hi,

tested x86_64-linux, committed.

Thanks,
Paolo.


2011-06-09  Paolo Carlini  

* include/std/type_traits (__is_copy_assignable_impl,
__is_nt_copy_assignable_impl): Fix typos.
Index: include/std/type_traits
===
--- include/std/type_traits (revision 174838)
+++ include/std/type_traits (working copy)
@@ -1029,7 +1029,7 @@
 
   template
 struct __is_copy_assignable_impl<_Tp, false>
-: public is_assignable<_Tp&, const _Tp&&>
+: public is_assignable<_Tp&, const _Tp&>
 { };
 
   /// is_copy_assignable
@@ -1077,7 +1077,7 @@
 
   template
 struct __is_nt_copy_assignable_impl<_Tp, false>
-: public is_nothrow_assignable<_Tp&, const _Tp&&>
+: public is_nothrow_assignable<_Tp&, const _Tp&>
 { };
 
   /// is_nothrow_copy_assignable


Re: [PATCH] Fix PR lto/49302

2011-06-09 Thread Richard Guenther
On Wed, Jun 8, 2011 at 6:56 PM, William J. Schmidt
 wrote:
> This patch adds code to the cse_sincos pass to expand builtin cabs (x)
> into sqrt (r*r + i*i), where r = realpart(x) and i = imagpart(x).  This
> is usually handled by fold_builtin_cabs; however, PR49302 shows a case
> where compile flags of -O0 -flto combined with link flags of -O2
> -ffast-math allow cabs to leak through.
>
> Test case gcc.dg/lto/20110201-1_0.c indicates that cabs is not
> guaranteed to be implemented in libm, so -lm is not specified for the
> test.  This patch does not present a perfect solution, in that it will
> produce a builtin call to sqrt for targets that don't have a hardware
> sqrt instruction.  Although sqrt should always be provided by libm, this
> test case will fail since -lm is not specified.  Note that this is not
> new behavior introduced by the patch, so this is probably OK; it just
> restores what was happening prior to the pow/powi fixes for PR46728.
>
> The test case has been verified fixed on x86_64-linux, and verified to
> fail only with an unsatisfied reference to sqrt on powerpc64-linux.
> Bootstrapped and regtested on both platforms.
>
> OK for trunk?
>
> Thanks,
> Bill
>
>
> 2011-06-08  Bill Schmidt  
>
>        PR lto/49302
>        * tree-ssa-math-opts.c (build_and_insert_ref): New.
>        (gimple_expand_builtin_cabs): New.
>        (execute_cse_sincos): Add case for BUILT_IN_CABS.
>
>
> Index: gcc/tree-ssa-math-opts.c
> ===
> --- gcc/tree-ssa-math-opts.c    (revision 174765)
> +++ gcc/tree-ssa-math-opts.c    (working copy)
> @@ -1070,6 +1070,22 @@ build_and_insert_binop (gimple_stmt_iterator *gsi,
>   return result;
>  }
>
> +/* Build a gimple reference operation with the given CODE and argument
> +   ARG, assigning the result to a new SSA name for variable TARGET.
> +   Insert the statement prior to GSI's current position, and return
> +   the fresh SSA name.*/

Two spaces after '.'

> +
> +static inline tree
> +build_and_insert_ref (gimple_stmt_iterator *gsi, location_t loc, tree type,
> +                     tree target, enum tree_code code, tree arg0)
> +{
> +  tree result = make_ssa_name (target, NULL);
> +  gimple stmt = gimple_build_assign (result, build1 (code, type, arg0));
> +  gimple_set_location (stmt, loc);
> +  gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
> +  return result;
> +}
> +
>  /* 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
> @@ -1306,6 +1322,41 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *g
>   return NULL_TREE;
>  }
>
> +/* ARG is the argument to a cabs builtin call in GSI with location info
> +   LOC.  Create a sequence of statements prior to GSI that calculates
> +   sqrt(R*R + I*I), where R and I are the real and imaginary components
> +   of ARG, respectively.  Return an expression holding the result.  */
> +
> +static tree
> +gimple_expand_builtin_cabs (gimple_stmt_iterator *gsi, location_t loc, tree 
> arg)
> +{
> +  tree target, real_part, imag_part, addend1, addend2, sum, result, sqrtfn;
> +  tree type = TREE_TYPE (arg);
> +
> +  gcc_assert (TREE_CODE (type) == COMPLEX_TYPE);

No need to assert this.

> +  type = TREE_TYPE (type);
> +  sqrtfn = mathfn_built_in (type, BUILT_IN_SQRT);
> +
> +  if (!sqrtfn)
> +    return NULL_TREE;

I think we should only do this when a HW sqrt is available.

> +
> +  target = create_tmp_var (type, "cabs");
> +  add_referenced_var (target);
> +
> +  real_part = build_and_insert_ref (gsi, loc, type, target,
> +                                   REALPART_EXPR, arg);
> +  addend1 = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
> +                                   real_part, real_part);
> +  imag_part = build_and_insert_ref (gsi, loc, type, target,
> +                                   IMAGPART_EXPR, arg);
> +  addend2 = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
> +                                   imag_part, imag_part);
> +  sum = build_and_insert_binop (gsi, loc, target, PLUS_EXPR, addend1, 
> addend2);
> +  result = build_and_insert_call (gsi, loc, &target, sqrtfn, sum);
> +
> +  return result;
> +}
> +
>  /* 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.  */
> @@ -1388,6 +1439,34 @@ execute_cse_sincos (void)
>                    }
>                  break;
>
> +               CASE_FLT_FN (BUILT_IN_CABS):
> +                 /* This code is usually redundant with fold_builtin_cabs.
> +                    There is a possible edge case where compile flags
> +                    include -O0 -flto, while link flags include -O2
> +                    -ffast-math.  In this case, the fold does not occur
> +                    and cabs c

Re: [PATCH] c-pragma: adding a data field to pragma_handler

2011-06-09 Thread Pierre Vittet

You are right, the new version is in the diff.
The diff for the test hasn't changed and is in the previous mail.

In the previous version of the file, the registered_pragmas was not 
better freed. I don't know if it is really important (it would need a 
callback at the end of the front-end passes).


Thanks.



On 09/06/2011 08:16, Basile Starynkevitch wrote:

On Wed, 08 Jun 2011 23:26:39 +0200
Pierre Vittet  wrote:

   

I have written a test for this patch and run it (it works correctly). I
guess there is no reason why it should not be accepted now.
To recap, this patch add a void * data field to the pragma handler,
allowing to pass extra data. If we want to use this field, we need to
use the function c_register_pragma_with_data or
c_register_pragma_with_expansion_and_data. The old
c_register_pragma(_with_expansion) is kept compatible.
 


===
--- gcc/c-family/c-pragma.c (revision 174521)
+++ gcc/c-family/c-pragma.c (working copy)
@@ -1148,12 +1148,12 @@ handle_pragma_float_const_decimal64 (cpp_reader
*A }

  /* A vector of registered pragma callbacks.  */
+/* This is never freed as we need it during the whole execution.  */
+DEF_VEC_O (internal_pragma_handler);
+DEF_VEC_ALLOC_O (internal_pragma_handler, heap);

Sorry to be picky Pierre, but that comment is not correct. It should be
instead.

/* A vector of registered pragma callbacks, which is never freed.   */

What I mean is that you are right that the vector is never freed, but
it is not because it is needed during the entire execution, since
middle-end and back-end passes don't know about pragmas.

I hope your patch will be ok-ed with that small change.

Perhaps a future patch would free that registered_pragmas vector, but I
feel that is not necessary, since it is not a big vector in practice.

Regards.

   


Index: gcc/c-family/c-pragma.c
===
--- gcc/c-family/c-pragma.c (revision 174521)
+++ gcc/c-family/c-pragma.c (working copy)
@@ -1147,13 +1147,12 @@ handle_pragma_float_const_decimal64 (cpp_reader *A
 }
 }
 
-/* A vector of registered pragma callbacks.  */
+/* A vector of registered pragma callbacks, which is never freed.   */
+DEF_VEC_O (internal_pragma_handler);
+DEF_VEC_ALLOC_O (internal_pragma_handler, heap);
 
-DEF_VEC_O (pragma_handler);
-DEF_VEC_ALLOC_O (pragma_handler, heap);
+static VEC(internal_pragma_handler, heap) *registered_pragmas;
 
-static VEC(pragma_handler, heap) *registered_pragmas;
-
 typedef struct
 {
   const char *space;
@@ -1216,7 +1215,7 @@ c_pp_lookup_pragma (unsigned int id, const char **
 
 static void
 c_register_pragma_1 (const char *space, const char *name,
-pragma_handler handler, bool allow_expansion)
+ internal_pragma_handler ihandler, bool allow_expansion)
 {
   unsigned id;
 
@@ -1235,8 +1234,9 @@ c_register_pragma_1 (const char *space, const char
 }
   else
 {
-  VEC_safe_push (pragma_handler, heap, registered_pragmas, &handler);
-  id = VEC_length (pragma_handler, registered_pragmas);
+  VEC_safe_push (internal_pragma_handler, heap, registered_pragmas,
+ &ihandler);
+  id = VEC_length (internal_pragma_handler, registered_pragmas);
   id += PRAGMA_FIRST_EXTERNAL - 1;
 
   /* The C++ front end allocates 6 bits in cp_token; the C front end
@@ -1248,28 +1248,90 @@ c_register_pragma_1 (const char *space, const char
allow_expansion, false);
 }
 
+/* Register a C pragma handler, using a space and a name.  It disallows pragma
+expansion (if you want it, use c_register_pragma_with_expansion instead).  */
 void
-c_register_pragma (const char *space, const char *name, pragma_handler handler)
+c_register_pragma (const char *space, const char *name,
+   pragma_handler_1arg handler)
 {
-  c_register_pragma_1 (space, name, handler, false);
+  internal_pragma_handler ihandler;
+
+  ihandler.handler.handler_1arg = handler;
+  ihandler.extra_data = false;
+  ihandler.data = NULL;
+  c_register_pragma_1 (space, name, ihandler, false);
 }
 
+/* Register a C pragma handler, using a space and a name, it also carries an
+extra data field which can be used by the handler.  It disallows pragma
+expansion (if you want it, use c_register_pragma_with_expansion instead).  */
 void
+c_register_pragma_with_data (const char *space, const char *name,
+ pragma_handler_2arg handler, void * data)
+{
+  internal_pragma_handler ihandler;
+
+  ihandler.handler.handler_2arg = handler;
+  ihandler.extra_data = true;
+  ihandler.data = data;
+  c_register_pragma_1 (space, name, ihandler, false);
+}
+
+/* Register a C pragma handler, using a space and a name.  It allows pragma
+expansion as in the following exemple:
+  #define NUMBER 10
+  #pragma count (NUMBER)
+Name expansion is still disallowed.  */
+void
 c_register_pragma_with_e

Re: Dump before flag

2011-06-09 Thread Richard Guenther
On Thu, Jun 9, 2011 at 12:31 AM, Xinliang David Li  wrote:
> this is the patch that just removes the TODO_dump flag and forces it
> to dump. The original code cfun->last_verified = flags &
> TODO_verify_all looks weird -- depending on TODO_dump is set or not,
> the behavior of the update is different (when no other todo flags is
> set).
>
> Ok for trunk?

-ENOPATCH.

Richard.

> David
>
> On Wed, Jun 8, 2011 at 9:52 AM, Xinliang David Li  wrote:
>> On Wed, Jun 8, 2011 at 2:06 AM, Richard Guenther
>>  wrote:
>>> On Wed, Jun 8, 2011 at 1:08 AM, Xinliang David Li  
>>> wrote:
 The following is the patch that does the job. Most of the changes are
 just  removing TODO_dump_func. The major change is in passes.c and
 tree-pass.h.

 -fdump-xxx-yyy-start       <-- dump before TODO_start
 -fdump-xxx-yyy-before    <-- dump before main pass after TODO_pass
 -fdump-xxx-yyy-after       <-- dump after main pass before TODO_finish
 -fdump-xxx-yyy-finish      <-- dump after TODO_finish
>>>
>>> Can we bikeshed a bit more about these names?
>>
>> These names may be less confusing:
>>
>> before_preparation
>> before
>> after
>> after_cleanup
>>
>> David
>>
>>> "start" and "before"
>>> have no semantical difference to me ... as the dump before TODO_start
>>> of a pass and the dump after TODO_finish of the previous pass are
>>> identical (hopefully ;)), maybe merge those into a -between flag?
>>> If you'd specify it for a single pass then you'd get both -start and -finish
>>> (using your naming scheme).  Splitting that dump(s) to different files
>>> then might make sense (not sure about the name to use).
>>>
>>> Note that I find it extremely useful to have dumping done in
>>> chronological order - splitting some of it to different files destroys
>>> this, especially a dump after TODO_start or before TODO_finish
>>> should appear in the same file (or we could also start splitting
>>> individual TODO_ output into sub-dump-files).  I guess what would
>>> be nice instread would be a fancy dump-file viewer that could
>>> show diffs, hide things like SCEV output, etc.
>>>
>>> I suppose a patch that removes the dump TODO and unconditionally
>>> dumps at the current point would be a good preparation for this
>>> enhancing patch.
>>>
>>> Richard.
>>>
 The default is 'finish'.

 Does it look ok?

 Thanks,

 David

 On Tue, Jun 7, 2011 at 2:36 AM, Richard Guenther
  wrote:
> On Mon, Jun 6, 2011 at 6:20 PM, Xinliang David Li  
> wrote:
>>>
>>> Your patch doesn't really improve this but adds to the confusion.
>>>
>>> +  /* Override dump TODOs.  */
>>> +  if (dump_file && (pass->todo_flags_finish & TODO_dump_func)
>>> +      && (dump_flags & TDF_BEFORE))
>>> +    {
>>> +      pass->todo_flags_finish &= ~TODO_dump_func;
>>> +      pass->todo_flags_start |= TODO_dump_func;
>>> +    }
>>>
>>> and certainly writing to pass is not ok.  And the TDF_BEFORE flag
>>> looks misplaced as it controls TODOs, not dumping behavior.
>>> Yes, it's a mess right now but the above looks like a hack ontop
>>> of that mess (maybe because of it, but well ...).
>>>
>>
>> How about removing dumping TODO completely -- this can be done easily
>> -- I don't understand why pass wants extra control on the dumping if
>> user already asked for dumping -- it is annoying to see empty IR dump
>> for a pass when I want to see it.
>>
>>> At least I would have expected to also get the dump after the
>>> pass, not only the one before it with this dump flag.
>>>
>>> Now, why can't you look at the previous pass output for the
>>> before-dump (as I do usually)?
>>
>> For one thing, you need to either remember what is the previous pass,
>> or dump all passes which for large files can take very long time. Even
>> with all the dumps, you will need to eyeballing to find the previous
>> pass which may or may not have the IR dumped.
>>
>> How about removing dump TODO?
>
> Yeah, I think this would go in the right direction.  Currently some passes
> do not dump function bodies because they presumably do no IL
> modification.  But this is certainly the minority (and some passes do not
> dump bodies even though they are modifying the IL ...).
>
> So I'd say we should by default dump function bodies.
>
> Note that there are three useful dumping positions (maybe four),
> before todo-start, after todo-start, before todo-finish and after 
> todo-finish.
> By default we'd want after todo-finish.  When we no longer dump via
> a TODO then we could indeed use dump-flags to control this
> (maybe -original for the body before todo-start).
>
> What to others think?
>
> Richard.
>
>> Thanks,
>>
>> David
>>
>>
>>>
>>> Richard.
>>>
>>
>

>>>
>>
>


Re: [lto, testsuite] Don't use visibility on targets that don't support it (PR lto/47334)

2011-06-09 Thread Richard Guenther
On Thu, Jun 9, 2011 at 9:14 AM, Rainer Orth  
wrote:
> Mike Stump  writes:
>
>> On Apr 5, 2011, at 1:56 AM, Rainer Orth wrote:
>>>  * lto.c (promote_var): Only set VISIBILITY_HIDDEN if
>>>      HAVE_GAS_HIDDEN.
>>
>> This looks wrong, there are more things that have visibility than those 
>> things that use GAS and have .hidden.  Darwin I think is one of them.  ?  
>> cygming.h seems to be another.
>
> Now that Darwin has been switched to define HAVE_GAS_HIDDEN, is the
> lto.c part ok?

Honza?  I think if we are not marking the symbols hidden we "break"
LTO in the way that we suddenly export local static symbols.  So no,
I don't think we want to do that - but then we need another way to
make it possible to access previously local statics from a different
LTO partition.

Richard.

> I've re-bootstrapped both patches together on i386-apple-darwin9.8.0,
> powerpc-apple-darwin9.8.0, i386-pc-solaris2.8 and i386-pc-solaris2.11
> without regressions; as expected the failure on Solaris 8/x86 is gone.
>
> Thanks.
>        Rainer
>
> --
> -
> Rainer Orth, Center for Biotechnology, Bielefeld University
>


Re: [build] Move ENABLE_EXECUTE_STACK to toplevel libgcc

2011-06-09 Thread Joseph S. Myers
On Thu, 9 Jun 2011, Rainer Orth wrote:

> Indeed, that did the trick.  The following revised patch has been
> bootstrapped without regressions on i386-pc-solaris2.10.  I've already
> got build, Darwin and Mingw approval and can commit the osf and solaris
> parts on my own.  If the C parts are ok now, I suppose I still need
> approval either from the various *BSD maintainers (who haven't chimed in
> yet) of from a global reviewer?

The C parts of this version are OK.

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


Re: [lto, testsuite] Don't use visibility on targets that don't support it (PR lto/47334)

2011-06-09 Thread Jan Hubicka
> On Thu, Jun 9, 2011 at 9:14 AM, Rainer Orth  
> wrote:
> > Mike Stump  writes:
> >
> >> On Apr 5, 2011, at 1:56 AM, Rainer Orth wrote:
> >>>  * lto.c (promote_var): Only set VISIBILITY_HIDDEN if
> >>>      HAVE_GAS_HIDDEN.
> >>
> >> This looks wrong, there are more things that have visibility than those 
> >> things that use GAS and have .hidden.  Darwin I think is one of them.  ?  
> >> cygming.h seems to be another.
> >
> > Now that Darwin has been switched to define HAVE_GAS_HIDDEN, is the
> > lto.c part ok?
> 
> Honza?  I think if we are not marking the symbols hidden we "break"
> LTO in the way that we suddenly export local static symbols.  So no,

Yes, on targets that do have concept of hidden symbols we ought to use the flag.

> I don't think we want to do that - but then we need another way to
> make it possible to access previously local statics from a different
> LTO partition.

I guess if we want to support targets that has nothing similar to hidden, we
can go for the random seed based mangling and simply export the nonsentially
named symbols.

Honza
> 
> Richard.
> 
> > I've re-bootstrapped both patches together on i386-apple-darwin9.8.0,
> > powerpc-apple-darwin9.8.0, i386-pc-solaris2.8 and i386-pc-solaris2.11
> > without regressions; as expected the failure on Solaris 8/x86 is gone.
> >
> > Thanks.
> >        Rainer
> >
> > --
> > -
> > Rainer Orth, Center for Biotechnology, Bielefeld University
> >


Re: Merge score7 to score.c and remove forwarding functions.

2011-06-09 Thread Joseph S. Myers
You didn't test this, did you?  Since it reverts my fixes to 
score_handle_option to avoid global state and it's hardly going to build 
cleanly with the old prototype for a hook that has changed prototype.

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


[patch, testsuite] Fix vectorizer testsuite failures on ARM

2011-06-09 Thread Ira Rosen
Hi,

This patch fixes several vectorizer testsuite failures on ARM:
- vect-16.c checks that the vectorization fails without -ffast-math,
but -ffast-math is a default flag for vector tests on ARM. I renamed
the test to no-fast-math-vect-16.c to avoid the use of the flag for
it.
- vect-peel-3.c and vect-peel-4.c test vectorizer's peeling heuristics
ignoring double-word vectors. This patch changes the misalignment
values of the data-refs.
- bb-slp-10.c contains a misaligned store supported not only on
vect_hw_misalign targets, but also on vect_element_align targets. The
patch fixes that.

Tested on arm-linux-gnueabi, powerpc64-suse-linux and x86_64-suse-linux.
OK for mainline?

Thanks,
Ira

testsuite/ChangeLog:

   * gcc.dg/vect/vect-16.c: Rename to ...
   * gcc.dg/vect/no-fast-math-vect16.c: ... this.
   * gcc.dg/vect/vect-peel-3.c: Adjust misalignment values
   for double-word vectors.
   * gcc.dg/vect/vect-peel-4.c: Likewise.
   * gcc.dg/vect/bb-slp-10.c: Replace vect_hw_misalign with
   vect_element_align.
   * gcc.dg/vect/vect.exp: Run no-fast-math-* tests with
   -fno-fast-math.
Index: gcc.dg/vect/vect-16.c
===
--- gcc.dg/vect/vect-16.c   (revision 174836)
+++ gcc.dg/vect/vect-16.c   (working copy)
@@ -1,38 +0,0 @@
-/* { dg-require-effective-target vect_float } */
-
-#include 
-#include "tree-vect.h"
-
-#define N 16
-#define DIFF 240
-
-__attribute__ ((noinline))
-int main1 ()
-{
-  int i;
-  float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-  float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-  float diff;
-
-  diff = 0;
-  for (i = 0; i < N; i++) {
-diff += (b[i] - c[i]);
-  }
-
-  /* check results:  */
-  if (diff != DIFF)
-abort ();
-
-  return 0;
-}
-
-int main (void)
-{ 
-  check_vect ();
-  
-  return main1 ();
-}
-
-/* Requires fast-math.  */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail 
*-*-* } } } */
-/* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc.dg/vect/vect-peel-3.c
===
--- gcc.dg/vect/vect-peel-3.c   (revision 174836)
+++ gcc.dg/vect/vect-peel-3.c   (working copy)
@@ -4,9 +4,7 @@
 #include "tree-vect.h"
 
 #define N 128
-#define RES 21888 
-
-/* unaligned store.  */
+#define RES 21640 
 
 int ib[N+10];
 int ia[N+10];
@@ -18,11 +16,11 @@ int main1 ()
   int i, suma = 0, sumb = 0, sumc = 0;
 
   /* ib and ic have same misalignment, we peel to align them.  */
-  for (i = 1; i <= N; i++)
+  for (i = 0; i <= N; i++)
 {
   suma += ia[i];
-  sumb += ib[i+6];
-  sumc += ic[i+2];
+  sumb += ib[i+5];
+  sumc += ic[i+1];
 }
 
   /* check results:  */
Index: gcc.dg/vect/vect-peel-4.c
===
--- gcc.dg/vect/vect-peel-4.c   (revision 174836)
+++ gcc.dg/vect/vect-peel-4.c   (working copy)
@@ -16,13 +16,13 @@ int main1 ()
   /* Don't peel keeping one load and the store aligned.  */
   for (i = 0; i <= N; i++)
 {
-  ia[i] = ib[i] + ib[i+6];
+  ia[i] = ib[i] + ib[i+5];
 }
 
   /* check results:  */
   for (i = 1; i <= N; i++)
 {
-  if (ia[i] != ib[i] + ib[i+6])
+  if (ia[i] != ib[i] + ib[i+5])
 abort ();
 }
 
Index: gcc.dg/vect/no-fast-math-vect16.c
===
--- gcc.dg/vect/no-fast-math-vect16.c   (revision 0)
+++ gcc.dg/vect/no-fast-math-vect16.c   (revision 0)
@@ -0,0 +1,38 @@
+/* { dg-require-effective-target vect_float } */
+
+#include 
+#include "tree-vect.h"
+
+#define N 16
+#define DIFF 240
+
+__attribute__ ((noinline))
+int main1 ()
+{
+  int i;
+  float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+  float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+  float diff;
+
+  diff = 0;
+  for (i = 0; i < N; i++) {
+diff += (b[i] - c[i]);
+  }
+
+  /* check results:  */
+  if (diff != DIFF)
+abort ();
+
+  return 0;
+}
+
+int main (void)
+{ 
+  check_vect ();
+  
+  return main1 ();
+}
+
+/* Requires fast-math.  */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail 
*-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc.dg/vect/bb-slp-10.c
===
--- gcc.dg/vect/bb-slp-10.c (revision 174836)
+++ gcc.dg/vect/bb-slp-10.c (working copy)
@@ -49,7 +49,7 @@ int main (void)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "unsupported alignment in basic block." 1 
"slp" { xfail vect_hw_misalign } } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 
"slp" { target vect_hw_misalign } } } */
+/* { dg-final { scan-tree-dump-times "unsupported alignment in basic block." 1 
"slp" { xfail vect_element_align } } } */
+/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 
"slp" { target vect_element_align } } } */

[C++ Patch] PR 29003

2011-06-09 Thread Paolo Carlini

Hi,

I tested on x86_64-linux the below patchlet for a long standing 
accepts-invalid. Is it ok for mainline? Or do we want a different error 
message? A somehow tighter check?


Thanks,
Paolo.

//
/cp
2011-06-09  Paolo Carlini  

PR c++/29003
* decl.c (grokdeclarator): Reject operator names in typedefs.

/testsuite
2011-06-09  Paolo Carlini  

PR c++/29003
* g++.dg/parse/error38.C: New.
Index: testsuite/g++.dg/parse/error38.C
===
--- testsuite/g++.dg/parse/error38.C(revision 0)
+++ testsuite/g++.dg/parse/error38.C(revision 0)
@@ -0,0 +1,3 @@
+// PR c++/29003
+
+typedef int operator !(); // { dg-error "not allowed" }
Index: cp/decl.c
===
--- cp/decl.c   (revision 174838)
+++ cp/decl.c   (working copy)
@@ -8441,6 +8441,13 @@ grokdeclarator (const cp_declarator *declarator,
   return error_mark_node;
 }
 
+  if (dname && IDENTIFIER_OPNAME_P (dname)
+  && declspecs->specs[(int)ds_typedef])
+{
+  error ("operator name is not allowed");
+  return error_mark_node;
+}
+
   /* Anything declared one level down from the top level
  must be one of the parameters of a function
  (because the body is at least two levels down).  */


[PATCH] Fix leslie3d performance regression with -flto/-fwhole-program

2011-06-09 Thread Richard Guenther

leslie3d terminates itself with STOP which translates to a noreturn
function.  This causes our edge hot/cold prediction machinery to not
apply any predictions based on paths to noreturn functions (because
there is no path that does not lead to a noreturn function).  This
in turn makes us predict the error path for ALLOCATE statements
as likely, leading to the tail of the function becoming cold.
This is because the error path is guarded by a if (ptr != 0) which
is predicted as likely - that is quite unusual, so we should
mark those tests as unlikely.  Done with the following patch.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Ok for trunk?

Thanks,
Richard.

2011-06-09  Richard Guenther  

* trans.c (gfc_allocate_array_with_status): Mark error path
as unlikely.

Index: gcc/fortran/trans.c
===
--- gcc/fortran/trans.c (revision 174746)
+++ gcc/fortran/trans.c (working copy)
@@ -697,8 +697,9 @@ gfc_allocate_array_with_status (stmtbloc
 
   /* Create a variable to hold the result.  */
   res = gfc_create_var (type, NULL);
-  null_mem = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, mem,
- build_int_cst (type, 0));
+  null_mem = gfc_unlikely (fold_build2_loc (input_location, NE_EXPR,
+   boolean_type_node, mem,
+   build_int_cst (type, 0)));
 
   /* If mem is NULL, we call gfc_allocate_with_status.  */
   gfc_start_block (&alloc_block);
@@ -751,7 +752,7 @@ gfc_allocate_array_with_status (stmtbloc
 }
 
   tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, null_mem,
-alloc, error);
+error, alloc);
   gfc_add_expr_to_block (block, tmp);
 
   return res;


Re: [build] Move ENABLE_EXECUTE_STACK to toplevel libgcc

2011-06-09 Thread Bernd Schmidt
On 06/09/2011 09:42 AM, Rainer Orth wrote:
> Indeed, that did the trick.  The following revised patch has been
> bootstrapped without regressions on i386-pc-solaris2.10.  I've already
> got build, Darwin and Mingw approval and can commit the osf and solaris
> parts on my own.  If the C parts are ok now, I suppose I still need
> approval either from the various *BSD maintainers (who haven't chimed in
> yet) of from a global reviewer?

Presumably the BSD folks will eventually complain if something breaks.
Patch is OK.


bernd


[PATCH] Fix noreturn predictor to also work with no regular exits

2011-06-09 Thread Richard Guenther

This is a complementary fix for the leslie3d problem.  For functions
without a regular exit (for example one that exits with exit (0))
we do not apply noreturn predictors.   The following patch notices
that edges to noreturn calls are still unlikely if they have
exactly one predecessor and is not fallthru.  In the leslie3d
case this avoids predicting the edges to STOP but still correctly
predicts the edges to the exceptional noreturn functions.

Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok for trunk?

Thanks,
Richard.

2011-06-09  Richard Guenther  

* predict.c (tree_bb_level_predictions): For functions with
no regular exit still predict the edge to a block with a noreturn
function as not taken if it is not a fallthru edge.

Index: gcc/predict.c
===
--- gcc/predict.c   (revision 174746)
+++ gcc/predict.c   (working copy)
@@ -1613,10 +1613,18 @@ tree_bb_level_predictions (void)
 
  if (is_gimple_call (stmt))
{
- if ((gimple_call_flags (stmt) & ECF_NORETURN)
- && has_return_edges)
-   predict_paths_leading_to (bb, PRED_NORETURN,
- NOT_TAKEN);
+ if ((gimple_call_flags (stmt) & ECF_NORETURN))
+   {
+ if (has_return_edges)
+   predict_paths_leading_to (bb, PRED_NORETURN,
+ NOT_TAKEN);
+ else if (single_pred_p (bb))
+   {
+ edge e = single_pred_edge (bb);
+ if (!(e->flags & EDGE_FALLTHRU))
+   predict_edge_def (e, PRED_NORETURN, NOT_TAKEN);
+   }
+   }
  decl = gimple_call_fndecl (stmt);
  if (decl
  && lookup_attribute ("cold",



Re: [PATCH] Fix leslie3d performance regression with -flto/-fwhole-program

2011-06-09 Thread Tobias Burnus
Richard Guenther wrote:
> leslie3d terminates itself with STOP which translates to a noreturn
> function.  This causes our edge hot/cold prediction machinery to not
> apply any predictions based on paths to noreturn functions

> Bootstrapped and tested on x86_64-unknown-linux-gnu.
> Ok for trunk?

OK. Thanks for tracing this down and for the patch.
I think it is rather obvious.

(I only wonder a bit why that's a regression.)

Tobias

PS: Cross ref for gfortran readers: This patch has a sister middle-end
patch at http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00723.html


Re: [PATCH] Fix leslie3d performance regression with -flto/-fwhole-program

2011-06-09 Thread Richard Guenther
On Thu, 9 Jun 2011, Tobias Burnus wrote:

> Richard Guenther wrote:
> > leslie3d terminates itself with STOP which translates to a noreturn
> > function.  This causes our edge hot/cold prediction machinery to not
> > apply any predictions based on paths to noreturn functions
> 
> > Bootstrapped and tested on x86_64-unknown-linux-gnu.
> > Ok for trunk?
> 
> OK. Thanks for tracing this down and for the patch.
> I think it is rather obvious.
> 
> (I only wonder a bit why that's a regression.)

It's a "regression" in that, leslie3d runs slower with -fwhole-program
than without.

Richard.


Re: [PATCH] Remove set_sizetype

2011-06-09 Thread Eric Botcazou
> Now that there is a single place left to call set_sizetype we can
> remove it and initialize sizetypes properly from the start
> (in initialize_sizetypes).

Can you give a meaningful TYPE_NAME to sizetype?  Ada dump files now read:

_GLOBAL.SZ0_discr31 (integer p0, integer p1)
{
  return p1 <= p0 ? ((bitsizetype) (() p0 - 
() p1) + 1) * 8 : 0;
}

and this isn't very pretty.

-- 
Eric Botcazou


Re: Remove SETJMP_VIA_SAVE_AREA support

2011-06-09 Thread Eric Botcazou
> Poison it (in system.h)?

Let's keep pretending that it never existed. :-)

-- 
Eric Botcazou


Re: [PATCH] Remove set_sizetype

2011-06-09 Thread Richard Guenther
On Thu, 9 Jun 2011, Eric Botcazou wrote:

> > Now that there is a single place left to call set_sizetype we can
> > remove it and initialize sizetypes properly from the start
> > (in initialize_sizetypes).
> 
> Can you give a meaningful TYPE_NAME to sizetype?  Ada dump files now read:
> 
> _GLOBAL.SZ0_discr31 (integer p0, integer p1)
> {
>   return p1 <= p0 ? ((bitsizetype) (() p0 - 
> () p1) + 1) * 8 : 0;
> }
> 
> and this isn't very pretty.

It's on my todo - I need to fixup FEs to not expect a TYPE_DECL
everywhere.

Richard.


Re: [PATCH] better warning for section conflict

2011-06-09 Thread H.J. Lu
On Wed, Jun 8, 2011 at 3:07 AM, Andi Kleen  wrote:
> When erroring on a section type conflict print both locations.
> This makes it a lot easier to track them down, especially in LTO.
>
> This is still not quite good before it prints only one
> conflict pair currently instead of all, but at least all
> the problems can be fixed iteratively now.
>
> Better would be likely to have a majority vote and print
> everyone disagreeing.
>
> Passes bootstrap & test suite on x86_64-linux. Ok to commit?
>
> 2011-06-06  Andi Kleen  
>
>        * varasm.c (get_section): Print location of other conflict
>        for section conflicts.

Hi Andi,

You need to update 2 testcases due to extra message:

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


-- 
H.J.


Re: [PATCH] Fix noreturn predictor to also work with no regular exits

2011-06-09 Thread Richard Guenther
On Thu, 9 Jun 2011, Richard Guenther wrote:

> 
> This is a complementary fix for the leslie3d problem.  For functions
> without a regular exit (for example one that exits with exit (0))
> we do not apply noreturn predictors.   The following patch notices
> that edges to noreturn calls are still unlikely if they have
> exactly one predecessor and is not fallthru.  In the leslie3d
> case this avoids predicting the edges to STOP but still correctly
> predicts the edges to the exceptional noreturn functions.
> 
> Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok for trunk?

It regresses

FAIL: gcc.target/i386/umod-3.c scan-assembler-times divb 1

Richard.

> Thanks,
> Richard.
> 
> 2011-06-09  Richard Guenther  
> 
>   * predict.c (tree_bb_level_predictions): For functions with
>   no regular exit still predict the edge to a block with a noreturn
>   function as not taken if it is not a fallthru edge.
> 
> Index: gcc/predict.c
> ===
> --- gcc/predict.c (revision 174746)
> +++ gcc/predict.c (working copy)
> @@ -1613,10 +1613,18 @@ tree_bb_level_predictions (void)
>  
> if (is_gimple_call (stmt))
>   {
> -   if ((gimple_call_flags (stmt) & ECF_NORETURN)
> -   && has_return_edges)
> - predict_paths_leading_to (bb, PRED_NORETURN,
> -   NOT_TAKEN);
> +   if ((gimple_call_flags (stmt) & ECF_NORETURN))
> + {
> +   if (has_return_edges)
> + predict_paths_leading_to (bb, PRED_NORETURN,
> +   NOT_TAKEN);
> +   else if (single_pred_p (bb))
> + {
> +   edge e = single_pred_edge (bb);
> +   if (!(e->flags & EDGE_FALLTHRU))
> + predict_edge_def (e, PRED_NORETURN, NOT_TAKEN);
> + }
> + }
> decl = gimple_call_fndecl (stmt);
> if (decl
> && lookup_attribute ("cold",
> 
> 

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

[PATCH][C family] Fix pp_c_type_specifier IDENTIFIER_NODE handling

2011-06-09 Thread Richard Guenther

The current IDENTIFIER_NODE handling in pp_c_type_specifier can't work
because the first thing pp_c_tree_decl_identifier does is assert
that the passed tree is a DECL.  Instead the following patch arranges
us to use pp_c_identifier to dump an IDENTIFIER_NODE.

This (obvious?) patch is required to give a name to sizetype in
the middle-end.

I'll bootstrap/test it with some other changes, the gcc.dg testsuite
is now clean with sizetype having a IDENTIFIER_NODE TYPE_NAME.

Ok for trunk?

Thanks,
Richard.

2011-06-09  Richard Guenther  

c-family/
* c-pretty-print.c (pp_c_type_specifier): Use pp_c_identifier
to print a IDENTIFIER_NODE.

Index: gcc/c-family/c-pretty-print.c
===
--- gcc/c-family/c-pretty-print.c   (revision 174841)
+++ gcc/c-family/c-pretty-print.c   (working copy)
@@ -345,7 +345,7 @@ pp_c_type_specifier (c_pretty_printer *p
   break;
 
 case IDENTIFIER_NODE:
-  pp_c_tree_decl_identifier (pp, t);
+  pp_c_identifier (pp, IDENTIFIER_POINTER (t));
   break;
 
 case VOID_TYPE:


Re: [C++ Patch] PR 29003

2011-06-09 Thread Jason Merrill

On 06/09/2011 06:07 AM, Paolo Carlini wrote:

I tested on x86_64-linux the below patchlet for a long standing
accepts-invalid. Is it ok for mainline? Or do we want a different error
message? A somehow tighter check?


The error message needs to say something about typedef being the 
problem.  Maybe follow the pattern of the previous error, and say


error ("declaration of %qD as %", dname);

Jason


Re: [PATCH][C family] Fix pp_c_type_specifier IDENTIFIER_NODE handling

2011-06-09 Thread Joseph S. Myers
On Thu, 9 Jun 2011, Richard Guenther wrote:

> 2011-06-09  Richard Guenther  
> 
>   c-family/
>   * c-pretty-print.c (pp_c_type_specifier): Use pp_c_identifier
>   to print a IDENTIFIER_NODE.

OK.

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


Re: [C++ Patch] PR 29003

2011-06-09 Thread Paolo Carlini

On 06/09/2011 04:06 PM, Jason Merrill wrote:

On 06/09/2011 06:07 AM, Paolo Carlini wrote:

I tested on x86_64-linux the below patchlet for a long standing
accepts-invalid. Is it ok for mainline? Or do we want a different error
message? A somehow tighter check?


The error message needs to say something about typedef being the 
problem.  Maybe follow the pattern of the previous error, and say


error ("declaration of %qD as %", dname);

Right. Updated and retested. Is this variant Ok?

Thanks,
Paolo.

///
Index: testsuite/g++.dg/parse/error38.C
===
--- testsuite/g++.dg/parse/error38.C(revision 0)
+++ testsuite/g++.dg/parse/error38.C(revision 0)
@@ -0,0 +1,3 @@
+// PR c++/29003
+
+typedef int operator !(); // { dg-error "declaration" }
Index: cp/decl.c
===
--- cp/decl.c   (revision 174838)
+++ cp/decl.c   (working copy)
@@ -8441,6 +8441,13 @@ grokdeclarator (const cp_declarator *declarator,
   return error_mark_node;
 }
 
+  if (dname && IDENTIFIER_OPNAME_P (dname)
+  && declspecs->specs[(int)ds_typedef])
+{
+  error ("declaration of %qD as %", dname);
+  return error_mark_node;
+}
+
   /* Anything declared one level down from the top level
  must be one of the parameters of a function
  (because the body is at least two levels down).  */


Re: [C++ Patch] PR 29003

2011-06-09 Thread Jason Merrill

OK.

Jason


Re: [PATCH] c-pragma: adding a data field to pragma_handler

2011-06-09 Thread Joseph S. Myers
Thanks for this patch.  You need to adjust the formatting of the comments 
to match the existing style (in particular, indentation of second and 
subsequent lines of comments, and watch out for spelling errors (exemple, 
abstact).  For a struct, the explanations of individual fields should be 
in the comments on those fields rather than at the top of the struct.  The 
comment on c_register_pragma_with_data should refer to 
c_register_pragma_with_expansion_and_data rather than 
c_register_pragma_with_expansion.

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


Re: [PATCH] Print location for conflicting global regs in warning

2011-06-09 Thread Dominique Dhumieres
Andi,

PR49344 occured between 174833 and 174836 which correspond to your commits
for this patch and the two other ones. Could you please have a look?

BTW what is the way to CC you in bugzilla?

TIA

Dominique


Typed DWARF stack and convert to untyped

2011-06-09 Thread Jakub Jelinek
Hi!

On Fri, Mar 25, 2011 at 12:32:37PM +0100, Jakub Jelinek wrote:
> This patch on top of
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01224.html
> and
> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01723.html
> implements parts of Cary's typed DWARF stack proposal:
> http://www.dwarfstd.org/doc/040408.1.html

GCC currently doesn't fully adhere to the above SPEC (even with the
agreed on slight changes for some binary ops), in particular to the
binary ops operand need to have the same type.

Currently once a value on the stack is typed, the typedness
propagates forever through unary/binary ops (the only exception
are comparisons that push untyped result even for typed operands).

I'd like to propose convert to untyped operation, e.g.
DW_OP_GNU_convert <0> could do it (and maybe DW_OP_GNU_reinterpret <0>),
these would convert to an integral value of the same size as DWARF
address and make it untyped.  As DW_OP_GNU_convert operand is
uleb128 DIE offset within current CU, offset 0 certainly won't
contain any DIEs, because it is the first byte of the CU header.

Without this, currently GCC will sometimes end up with one
operand typed, another untyped.  While it is solvable even just on
the GCC side (mem_loc_descriptor would need to track whether the
TOS of the expression it returned is typed, untyped (or uncertain,
e.g. for DW_OP_GNU_parameter_ref), as that would be determined
by the matching DW_AT_GNU_call_site_value, and when e.g. for binary
operation one argument is determined as typed, the other argument
would need to be converted to typed as well if untyped, and any
uncertain operand of a binary op or unary that cares about the
sign would need to be converted to typed), I think it would
generate unnecessarily bloated code, as e.g. after a float is
converted to int or other small integer suddenly all further
additions etc. would need to convert constants etc. to typed values
(or use DW_OP_const_type).  With an convert to untyped operation,
mem_loc_descriptor could just ensure that for integral modes <=
DWARF_ADDR_SIZE the result is untyped (current gcc code sort of
assumes that) and only when a larger mode is needed or non-integral,
it would be typed, and when sign matters for operation of integral small
modes, it could just temporarily convert to typed and back.

Does this sound reasonable, or is it too ugly?

Jakub


Re: [PATCH] Remove set_sizetype

2011-06-09 Thread Richard Guenther
On Thu, 9 Jun 2011, Richard Guenther wrote:

> On Thu, 9 Jun 2011, Eric Botcazou wrote:
> 
> > > Now that there is a single place left to call set_sizetype we can
> > > remove it and initialize sizetypes properly from the start
> > > (in initialize_sizetypes).
> > 
> > Can you give a meaningful TYPE_NAME to sizetype?  Ada dump files now read:
> > 
> > _GLOBAL.SZ0_discr31 (integer p0, integer p1)
> > {
> >   return p1 <= p0 ? ((bitsizetype) (() p0 - 
> > () p1) + 1) * 8 : 0;
> > }
> > 
> > and this isn't very pretty.
> 
> It's on my todo - I need to fixup FEs to not expect a TYPE_DECL
> everywhere.

Like this, testing with the C family fixup.

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

Richard.

2011-06-09  Richard Guenther  

* stor-layout.c (initialize_sizetypes): Give names to all
sizetype kinds.

Index: gcc/stor-layout.c
===
--- gcc/stor-layout.c   (revision 174841)
+++ gcc/stor-layout.c   (working copy)
@@ -2215,8 +2215,7 @@ initialize_sizetypes (void)
 
   /* Create stubs for sizetype and bitsizetype so we can create constants.  */
   sizetype = make_node (INTEGER_TYPE);
-  /* ???  We can't set a name for sizetype because it appears in C diagnostics
- and pp_c_type_specifier doesn't deal with IDENTIFIER_NODE TYPE_NAMEs.  */
+  TYPE_NAME (sizetype) = get_identifier ("sizetype");
   TYPE_PRECISION (sizetype) = precision;
   TYPE_UNSIGNED (sizetype) = 1;
   TYPE_IS_SIZETYPE (sizetype) = 1;
@@ -2250,8 +2249,10 @@ initialize_sizetypes (void)
 
   /* Create the signed variants of *sizetype.  */
   ssizetype = make_signed_type (TYPE_PRECISION (sizetype));
+  TYPE_NAME (ssizetype) = get_identifier ("ssizetype");
   TYPE_IS_SIZETYPE (ssizetype) = 1;
   sbitsizetype = make_signed_type (TYPE_PRECISION (bitsizetype));
+  TYPE_NAME (sbitsizetype) = get_identifier ("sbitsizetype");
   TYPE_IS_SIZETYPE (sbitsizetype) = 1;
 }
 



[lra] patch to speed up LRA

2011-06-09 Thread Vladimir Makarov
The following patch removes coalescing when it is not necessary, 
decrease number of insns to process for constraints, fix a typo, and 
implements Joseph Myers proposals.


The patch was successfully bootstraped (with LRA which is default) on 
x86-64, itanium, and ppc64.


2011-06-09  Vladimir Makarov 

* lra-spills.c: Don't include toplev.h.

* lra-eliminations.c: Ditto.

* lra-lives.c: Ditto.

* lra-saves.c: Ditto.

* lra-coalesce.c: Ditto.

* lra-equivs.c: Ditto.

* lra.c: Ditto.
(lra): Skip coalescing after spills and some assignments. Remove
live range creation before spills.

* lra-constraints.c: Don't include toplev.h.
(inherit_reload_reg): Invalidate used
alternative for changed insn.

* lra-assigns.c: Don't include toplev.h.
(assign_by_spills): Remove parameter. Clear all_spilled_pseudos if
necessary.  Fix typo in setting changed_pseudo_bitmap.  Don't set
up changed_pseudo_bitmap for reload pseudos.
(lra_assign): Return flag of spilling non-reload and
non-inheritance pseudos.

* Makefile.in (lra.o, lra-assigns.o, lra-coalesce.o): Remove
dependence on toplev.h.
(lra-constraints.o, lra-eliminations.o, lra-lives.o, 
lra-saves.o): Ditto.

(lra-spills.o): Ditto.

* lra-int.h (lra_assign): Don't include toplev.h.
Change return type.
* target.def (register_bank): Move description from tm.texi.in.

* doc/tm.texi.in (TARGET_REGISTER_BANK): Move description to 
target.def.


* doc/tm.texi: Update.

Index: doc/tm.texi
===
--- doc/tm.texi (revision 174485)
+++ doc/tm.texi (working copy)
@@ -2858,16 +2858,7 @@ as below:
 @end defmac
 
 @deftypefn {Target Hook} int TARGET_REGISTER_BANK (int)
-A target hook which returns the register bank number to which the
-register @var{hard_regno} belongs to.  The smaller the number, the
-more preferable the hard register usage (when all other conditions are
-the same).  This hook can be used to prefer some hard register over
-others in LRA.  For example, some x86-64 register usage needs
-additional prefix which makes instructions longer.  The hook can
-return bigger bank number for such registers make them less favorable
-and as result making the generated code smaller.
-
-The default version of this target hook returns always zero.
+A target hook which returns the register bank number to which the  register 
@var{hard_regno} belongs to.  The smaller the number, the  more preferable the 
hard register usage (when all other conditions are  the same).  This hook can 
be used to prefer some hard register over  others in LRA.  For example, some 
x86-64 register usage needs  additional prefix which makes instructions longer. 
 The hook can  return bigger bank number for such registers make them less 
favorable  and as result making the generated code smaller.The default 
version of this target hook returns always zero.
 @end deftypefn
 
 @node Old Constraints
Index: doc/tm.texi.in
===
--- doc/tm.texi.in  (revision 174485)
+++ doc/tm.texi.in  (working copy)
@@ -2846,17 +2846,6 @@ as below:
 @end defmac
 
 @hook TARGET_REGISTER_BANK
-A target hook which returns the register bank number to which the
-register @var{hard_regno} belongs to.  The smaller the number, the
-more preferable the hard register usage (when all other conditions are
-the same).  This hook can be used to prefer some hard register over
-others in LRA.  For example, some x86-64 register usage needs
-additional prefix which makes instructions longer.  The hook can
-return bigger bank number for such registers make them less favorable
-and as result making the generated code smaller.
-
-The default version of this target hook returns always zero.
-@end deftypefn
 
 @node Old Constraints
 @section Obsolete Macros for Defining Constraints
Index: lra-assigns.c
===
--- lra-assigns.c   (revision 174485)
+++ lra-assigns.c   (working copy)
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3.  
 #include "expr.h"
 #include "basic-block.h"
 #include "except.h"
-#include "toplev.h"
 #include "df.h"
 #include "ira.h"
 #include "sparseset.h"
@@ -889,11 +888,9 @@ static bitmap_head all_spilled_pseudos;
 /* All pseudos whose allocation was changed.  */
 static bitmap_head changed_pseudo_bitmap;
 
-/* Assign hard registers to reload pseudos and other pseudos.  Setup
-   insns should be processed on the next constraint pass in
-   TO_PROCESS.  */
+/* Assign hard registers to reload pseudos and other pseudos.  */
 static void
-assign_by_spills (bitmap to_process)
+assign_by_spills (void)
 {
   int i, n, nfails, iter, regno, hard_regno, cost;
   rtx insn, set;
@@ -943,7 +940,9 @@ assign_by_spills (bitmap to_pr

Re: [lra] A new branch

2011-06-09 Thread Vladimir Makarov

On 06/07/2011 09:46 AM, Joseph S. Myers wrote:

On Mon, 30 May 2011, Vladimir Makarov wrote:


* doc/tm.texi.in (TARGET_REGISTER_BANK): New hook.

Please include the text of documentation for new hooks in target.def
instead of tm.texi.in where possible (so tm.texi.in just has the @hook
line) - that is, unless it's based on older GFDL-only text.

A lot of the new source files appear to include toplev.h but I don't see
any uses of functions declared there.  I cleaned up toplev.h includes last
year; please make sure that source files only include headers they
actually need.

Thanks for pointing this out.  I've submitted the patch addressing these 
issues:


http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00741.html



Re: FORBIDDEN_INC_DEC_CLASSES in ira-costs.c

2011-06-09 Thread Vladimir Makarov

On 06/08/2011 12:37 PM, Hans-Peter Nilsson wrote:

There's a lot of dead code inside the obsolete (removed in 2009)
and nowhere else set #ifdef FORBIDDEN_INC_DEC_CLASSES.
Remove and poison?


Yes, I believe so.

I'd say borderline obvious, but maybe there's instead reason to
reinstate it, if that code is tested and supposed to be live.
I can not remember a reason to save it.  A big part of ira-costs.c was 
inherited from old reglcasses.c before the macro was removed.  Probably 
therefore it occurred again.


Thanks for finding this.  I'd really appreciate if you submit a patch 
removing this.  I'll try to give it a quick review.




Re: Fix PR49154-related SEGV in IRA. And ping.

2011-06-09 Thread Vladimir Makarov

On 06/08/2011 10:27 PM, Hans-Peter Nilsson wrote:

First, a ping for
;
updated regclass documentation.  Ok?



Sorry for the delay.  I actually thought about a better formulation for 
some time and forgot about this because I had to work on other urgent 
things.


I'd not say that is the best description of the requirement but I can 
not formulate the better one which is not too complicated.  So it is 
better to have something close than nothing.  It is ok for me.



Second, I updated the CRIS port to fit the proposed
documentation update (adding a class as the patch you sent, but
more complete), with regtest results clean for revisions before
the revision where build started failing.  But, after that
revision, I get a SEGV; details added to
.  At first
I thought I messed up the regclass description but it appears to
be just an obvious miss, fixed below.  If it isn't, I think
setup_regno_cost_classes_by_mode should have a comment as to who
else should set up regno_cost_classes[regno] and that "who else"
needs to be fixed to do the setup.  Odd that this bug didn't
trig before or for any of the targets on which you tested.
Maybe that makes cris-elf qualify for the set of targets you
test IRA changes on?

By the way, can we do a s/_aclass/_class/ in applicable files,
for example ira-costs.c?  Someone appears to have done a botched
word-replace of class to aclass; besides the identifier "class"
it changed occurrences within identifiers too (at least those
after a _) so we have e.g. cost_classes_aclass_cache and
setup_regno_cost_classes_by_aclass vs. cost_classes_mode_cache
and setup_regno_cost_classes_by_mode.

Tested on cris-elf; together with the mentioned update it
restores build with results consistent with those before the
breakage.

Ok to commit?



Yes.  Thanks for fixing this.


gcc:
PR rtl-optimization/49154
* ira-costs.c (setup_regno_cost_classes_by_mode): If there
already is a matching slot in the hashtable, assign it to
classes_ptr.

diff --git gcc/ira-costs.c gcc/ira-costs.c
index f517386..a22bb15 100644
--- gcc/ira-costs.c
+++ gcc/ira-costs.c
@@ -299,6 +299,8 @@ setup_regno_cost_classes_by_mode (int regno, enum 
machine_mode mode)
  classes_ptr = setup_cost_classes (&classes);
  *slot = classes_ptr;
}
+  else
+   classes_ptr = *slot;
cost_classes_mode_cache[mode] = (cost_classes_t) *slot;
  }
regno_cost_classes[regno] = classes_ptr;

brgds, H-P




[PATCH, i386]: Merge two alternatives in *movdi_internal_rex64

2011-06-09 Thread Uros Bizjak
Hello!

--- and reoder alternatives a bit.

2011-06-09  Uros Bizjak  

* config/i386/i386.md (*movdi_internal_rex64): Merge
alternatives 6 and 8.

Tested on x86_64-pc-linux-gnu, committed to mainline.

Uros.
Index: i386.md
===
--- i386.md (revision 174837)
+++ i386.md (working copy)
@@ -1975,9 +1975,9 @@
 
 (define_insn "*movdi_internal_rex64"
   [(set (match_operand:DI 0 "nonimmediate_operand"
- "=r,r  ,r,m ,!m,*y,*y,?r ,m ,?*Ym,?*y,*x,*x,?r ,m,?*Yi,*x,?*x,?*Ym")
+ "=r,r  ,r,m ,!m,*y,m*y,?*y,?r ,?*Ym,*x,m ,*x,*x,?r ,?*Yi,?*x,?*Ym")
(match_operand:DI 1 "general_operand"
- "Z ,rem,i,re,n ,C ,*y,*Ym,*y,r   ,m  ,C ,*x,*Yi,*x,r  ,m ,*Ym,*x"))]
+ "Z ,rem,i,re,n ,C ,*y ,m  ,*Ym,r   ,C ,*x,*x,m ,*Yi,r   ,*Ym,*x"))]
   "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
 {
   switch (get_attr_type (insn))
@@ -2027,18 +2027,18 @@
 }
 }
   [(set (attr "type")
- (cond [(eq_attr "alternative" "5")
+ (cond [(eq_attr "alternative" "4")
+ (const_string "multi")
+   (eq_attr "alternative" "5")
  (const_string "mmx")
-   (eq_attr "alternative" "6,7,8,9,10")
+   (eq_attr "alternative" "6,7,8,9")
  (const_string "mmxmov")
-   (eq_attr "alternative" "11")
+   (eq_attr "alternative" "10")
  (const_string "sselog1")
-   (eq_attr "alternative" "12,13,14,15,16")
+   (eq_attr "alternative" "11,12,13,14,15")
  (const_string "ssemov")
-   (eq_attr "alternative" "17,18")
+   (eq_attr "alternative" "16,17")
  (const_string "ssecvt")
-   (eq_attr "alternative" "4")
- (const_string "multi")
(match_operand:DI 1 "pic_32bit_operand" "")
  (const_string "lea")
   ]
@@ -2054,18 +2054,18 @@
 (const_string "8")
 (const_string "*")))
(set (attr "prefix_rex")
- (if_then_else (eq_attr "alternative" "7,9")
+ (if_then_else (eq_attr "alternative" "8,9")
(const_string "1")
(const_string "*")))
(set (attr "prefix_data16")
- (if_then_else (eq_attr "alternative" "15")
+ (if_then_else (eq_attr "alternative" "11")
(const_string "1")
(const_string "*")))
(set (attr "prefix")
- (if_then_else (eq_attr "alternative" "11,12,13,14,15,16")
+ (if_then_else (eq_attr "alternative" "10,11,12,13,14,15")
(const_string "maybe_vex")
(const_string "orig")))
-   (set_attr "mode" 
"SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,DI,TI,TI,DI,DI,DI,DI,DI,DI")])
+   (set_attr "mode" "SI,DI,DI,DI,SI,DI,DI,DI,DI,DI,TI,DI,TI,DI,DI,DI,DI,DI")])
 
 ;; Convert impossible stores of immediate to existing instructions.
 ;; First try to get scratch register and go through it.  In case this


[testsuite]: Skip tests for targets with int < 32 bits

2011-06-09 Thread Georg-Johann Lay
This patch fixes testsuite failures because the testcases assume
sizeof(int) >= 4.

* gcc.c-torture/compile/pr49029.c: Add dg-require-effective-target
int32plus
* gcc.c-torture/compile/pr49163.c: Ditto.
Index: gcc.c-torture/compile/pr49029.c
===
--- gcc.c-torture/compile/pr49029.c	(Revision 174701)
+++ gcc.c-torture/compile/pr49029.c	(Arbeitskopie)
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target int32plus } */
 /* PR middle-end/49029 */
 struct S { volatile unsigned f : 11; signed g : 30; } __attribute__((packed));
 struct T { volatile struct S h; } __attribute__((packed)) a;
Index: gcc.c-torture/compile/pr49163.c
===
--- gcc.c-torture/compile/pr49163.c	(Revision 174701)
+++ gcc.c-torture/compile/pr49163.c	(Arbeitskopie)
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target int32plus } */
 /* PR target/49163 */
 struct S1
 {


[Patch, AVR]: Fix PR46779

2011-06-09 Thread Georg-Johann Lay
This is a tentative patch to fix PR46779 and hopefully also related
issues like PR45291.

In the present version of avr_hard_regno_mode_ok, QImode is forbidden
in r29/r28. If a 16-bit value or composite is allocated to r28, this
can lead to odd subregs like
  (set (subreg:QI (reg:HI r28) 0) ...)
These subregs are produced by IRA and reload treats the subreg with a
RELOAD_WRITE. As reload spills r28 to another hard reg that can access
QI, there will be no input reload. Therefore, if r29 already contains
data that data will get garbaged. See also the discussion around

http://gcc.gnu.org/ml/gcc/2011-06/msg5.html

Tested with two regressions less compared to unpatched compiler.
Testcases that now pass are:

* gcc.target/avr/pr46779-1.c
* gcc.target/avr/pr46779-2.c

Johann

--
PR target/46779
* config/avr/avr.c (avr_hard_regno_mode_ok): Rewrite.
In particular, allow 8-bit values in r28 and r29.
(avr_hard_regno_scratch_ok): Disallow any register that might be
part of the frame pointer.
(avr_hard_regno_rename_ok): Same.
Index: config/avr/avr.c
===
--- config/avr/avr.c	(Revision 174701)
+++ config/avr/avr.c	(Arbeitskopie)
@@ -6276,26 +6276,35 @@ jump_over_one_insn_p (rtx insn, rtx dest
 int
 avr_hard_regno_mode_ok (int regno, enum machine_mode mode)
 {
-  /* Disallow QImode in stack pointer regs.  */
-  if ((regno == REG_SP || regno == (REG_SP + 1)) && mode == QImode)
+  /* Don't allocate data to non-GENERAL_REGS registers.  */
+  
+  if (regno >= 32)
 return 0;
 
-  /* The only thing that can go into registers r28:r29 is a Pmode.  */
-  if (regno == REG_Y && mode == Pmode)
+  /* Any GENERAL_REGS register can hold 8-bit values.  */
+  /* FIXME:
+ 8-bit values must not be disallowed for R28 or R29.  Disallowing
+ QI et al. in these registers might lead to code like
+ (set (subreg:QI (reg:HI 28)) ...)
+ which will result in wrong code because reload does not handle
+ SUBREGs of hard regsisters like this.  This could be fixed in reload.
+ However, it appears that fixing reload is not wanted by reload people.  */
+  
+  if (GET_MODE_SIZE (mode) == 1)
 return 1;
+  
+  /* Disallow big registers that overlap the frame pointer.
+ This will hopefully reduce the number of spill failures.  */
+  
+  if (GET_MODE_SIZE (mode) > 2
+  && regno <= REG_Y
+  && regno + GET_MODE_SIZE (mode) >= REG_Y + 1)
+{
+  return 0;
+}
 
-  /* Otherwise disallow all regno/mode combinations that span r28:r29.  */
-  if (regno <= (REG_Y + 1) && (regno + GET_MODE_SIZE (mode)) >= (REG_Y + 1))
-return 0;
-
-  if (mode == QImode)
-return 1;
-
-  /* Modes larger than QImode occupy consecutive registers.  */
-  if (regno + GET_MODE_SIZE (mode) > FIRST_PSEUDO_REGISTER)
-return 0;
-
-  /* All modes larger than QImode should start in an even register.  */
+  /* All modes larger than 8 bits should start in an even register.  */
+  
   return !(regno & 1);
 }
 
@@ -6422,13 +6431,23 @@ avr_hard_regno_scratch_ok (unsigned int
   && !df_regs_ever_live_p (regno))
 return false;
 
+  /* Don't allow hard registers that might be part of the frame pointer.
+ Some places in the compiler just test for [HARD_]FRAME_POINTER_REGNUM
+ and don't care for a frame pointer that spans more than one register.  */
+
+  if ((!reload_completed || frame_pointer_needed)
+  && (regno == REG_Y || regno == REG_Y + 1))
+{
+  return false;
+}
+
   return true;
 }
 
 /* Return nonzero if register OLD_REG can be renamed to register NEW_REG.  */
 
 int
-avr_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
+avr_hard_regno_rename_ok (unsigned int old_reg,
 			  unsigned int new_reg)
 {
   /* Interrupt functions can only use registers that have already been
@@ -6439,6 +6458,17 @@ avr_hard_regno_rename_ok (unsigned int o
   && !df_regs_ever_live_p (new_reg))
 return 0;
 
+  /* Don't allow hard registers that might be part of the frame pointer.
+ Some places in the compiler just test for [HARD_]FRAME_POINTER_REGNUM
+ and don't care for a frame pointer that spans more than one register.  */
+
+  if ((!reload_completed || frame_pointer_needed)
+  && (old_reg == REG_Y || old_reg == REG_Y + 1
+  || new_reg == REG_Y || new_reg == REG_Y + 1))
+{
+  return 0;
+}
+  
   return 1;
 }
 


[PATCH] Un-obsolete Interix

2011-06-09 Thread Douglas B Rupp
This patch restores interix v3 and above to working condition, combines 
the multitude of config/*interix*.h files into one file, removes unused 
bits, and fixes PR 47096.


Comments welcome.

--Douglas B Rupp


2011-06-09  Douglas B Rupp  

* /config/mh-interix: Remove.
* /configure.ac (host_makefile_frag): Remove above.
* /configure: Regenerate

* config/i386/i386-interix3.h: Incorporate this file ...
* config/interix3.h: Likewise
* config/interix.h: Likewise
* config/i386/i386-interix.h: ... into here and remove pre-Interix3
bits.

* config/interix.opt: Incorporate this file ...
* config/i386/interix.opt: ... into here.

* config/i386/t-interix (winnt-cxx.o,winnt-stubs.o,msformat-c.o): Add
rules to build.

* config.gcc: Rename interix3* to interix[3-9]*. Fix macros to reflect
config file changes. Remove interix3 from obsolete configurations.
* configure.ac (HAVE_GAS_ALIGNED_COMM): Allow on Interix.
* configure: Regenerate.

* testsuite/gcc.dg/builtins-config.h: (__INTERIX): Not C99.

* libgcc/config.host: Rename interix3* to interix[3-9]*.

* doc/install.texi: Note that gcc supports Interix version 3 and above.

diff -rupN gcc.orig/config/mh-interix gcc/config/mh-interix
--- gcc.orig/config/mh-interix  2011-04-06 16:54:04.0 -0700
+++ gcc/config/mh-interix   1969-12-31 16:00:00.0 -0800
@@ -1,7 +0,0 @@
-# The shell may not be in /bin. 
-SHELL = sh
-
-# We also need to override LIBGCC2_DEBUG_CFLAGS so libgcc2 will be
-# built without debugging information
-
-LIBGCC2_DEBUG_CFLAGS=
diff -rupN gcc.orig/configure.ac gcc/configure.ac
--- gcc.orig/configure.ac   2011-06-01 13:35:36.0 -0700
+++ gcc/configure.ac2011-06-01 15:46:59.0 -0700
@@ -1083,9 +1085,6 @@ case "${host}" in
   *-mingw*)
 host_makefile_frag="config/mh-mingw"
 ;;
-  *-interix*)
-host_makefile_frag="config/mh-interix"
-;;
   hppa*-hp-hpux10*)
 host_makefile_frag="config/mh-pa-hpux10"
 ;;
diff -rupN gcc.orig/gcc/config/i386/i386-interix3.h 
gcc/gcc/config/i386/i386-interix3.h
--- gcc.orig/gcc/config/i386/i386-interix3.h2011-04-06 16:49:50.0 
-0700
+++ gcc/gcc/config/i386/i386-interix3.h 1969-12-31 16:00:00.0 -0800
@@ -1,23 +0,0 @@
-/* Target definitions for GCC for Intel 80386 running Interix V3.
-   Copyright (C) 2001, 2007 Free Software Foundation, Inc.
-   Contributed by Douglas B. Rupp (r...@gnat.com)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-.  */
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-
diff -rupN gcc.orig/gcc/config/interix3.h gcc/gcc/config/interix3.h
--- gcc.orig/gcc/config/interix3.h  2011-04-06 16:50:26.0 -0700
+++ gcc/gcc/config/interix3.h   1969-12-31 16:00:00.0 -0800
@@ -1,34 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for
-   Interix version 3.
-   Copyright (C) 2001, 2007 Free Software Foundation, Inc.
-   Contributed by Douglas B. Rupp (r...@gnat.com)
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-.  */
-
-/* Interix 3.x has a single rooted file system and properly named
-   libraries, so LIB_SPEC can be simplified */
-
-#undef LIB_SPEC
-#define LIB_SPEC "\
- %{!shared:%{!dynamic:-lc -lpsxdll \
- }} \
- %{!G:%{!dynamic:-lc -lpsxdll \
- }} \
- %{dynamic:-lc -lpsxdll \
- } \
- %{v}"
-
diff -rupN gcc.orig/gcc/config/interix.h gcc/gcc/config/interix.h
--- gcc.orig/gcc/config/interix.h   2011-04-06 16:50:26.0 -0700
+++ gcc/gcc/config/interix.h1969-12-31 16:00:00.0 -0800
@@ -1,110 +0,0 @@
-/* Operating system specific defines to be used when targeting GCC for
-   Interix
-   Copyright (C) 1994, 1995, 1999, 2002, 2004, 2007, 2010
-   Free Software

[google] backport 174848, 174849 to google/main

2011-06-09 Thread Xinliang David Li
Backported -fdump-passes option impl.

David


[PATCH] Fix PR lto/49302 (corrected)

2011-06-09 Thread William J. Schmidt
Richard, thanks for the comments.  Here's the revised patch for
expanding cabs in gimple.

Given the direction this pass is taking, should it eventually be renamed
from cse_sincos to something more general?

Thanks,
Bill


2011-06-09  Bill Schmidt  

PR lto/49302
* tree-ssa-math-opts.c (build_and_insert_ref): New.
(gimple_expand_builtin_pow): Minor cleanup.
(gimple_expand_builtin_cabs): New.
(execute_cse_sincos): Add case for BUILT_IN_CABS.


Index: gcc/tree-ssa-math-opts.c
===
--- gcc/tree-ssa-math-opts.c(revision 174845)
+++ gcc/tree-ssa-math-opts.c(working copy)
@@ -1070,6 +1070,22 @@ build_and_insert_binop (gimple_stmt_iterator *gsi,
   return result;
 }
 
+/* Build a gimple reference operation with the given CODE and argument
+   ARG, assigning the result to a new SSA name for variable TARGET.  
+   Insert the statement prior to GSI's current position, and return
+   the fresh SSA name.  */
+
+static inline tree
+build_and_insert_ref (gimple_stmt_iterator *gsi, location_t loc, tree type,
+ tree target, enum tree_code code, tree arg0)
+{
+  tree result = make_ssa_name (target, NULL);
+  gimple stmt = gimple_build_assign (result, build1 (code, type, arg0));
+  gimple_set_location (stmt, loc);
+  gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+  return result;
+}
+
 /* 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
@@ -1124,7 +1140,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *g
  if we don't have a hardware sqrt insn.  */
   dconst1_4 = dconst1;
   SET_REAL_EXP (&dconst1_4, REAL_EXP (&dconst1_4) - 2);
-  hw_sqrt_exists = optab_handler(sqrt_optab, mode) != CODE_FOR_nothing;
+  hw_sqrt_exists = optab_handler (sqrt_optab, mode) != CODE_FOR_nothing;
 
   if (flag_unsafe_math_optimizations
   && sqrtfn
@@ -1306,6 +1322,42 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *g
   return NULL_TREE;
 }
 
+/* ARG is the argument to a cabs builtin call in GSI with location info
+   LOC.  Create a sequence of statements prior to GSI that calculates
+   sqrt(R*R + I*I), where R and I are the real and imaginary components
+   of ARG, respectively.  Return an expression holding the result.  */
+
+static tree
+gimple_expand_builtin_cabs (gimple_stmt_iterator *gsi, location_t loc, tree 
arg)
+{
+  tree target, real_part, imag_part, addend1, addend2, sum, result;
+  tree type = TREE_TYPE (TREE_TYPE (arg));
+  tree sqrtfn = mathfn_built_in (type, BUILT_IN_SQRT);
+  enum machine_mode mode = TYPE_MODE (type);
+
+  if (!flag_unsafe_math_optimizations
+  || !optimize_bb_for_speed_p (gimple_bb (gsi_stmt (*gsi)))
+  || !sqrtfn
+  || optab_handler (sqrt_optab, mode) == CODE_FOR_nothing)
+return NULL_TREE;
+
+  target = create_tmp_var (type, "cabs");
+  add_referenced_var (target);
+
+  real_part = build_and_insert_ref (gsi, loc, type, target,
+   REALPART_EXPR, arg);
+  addend1 = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
+   real_part, real_part);
+  imag_part = build_and_insert_ref (gsi, loc, type, target, 
+   IMAGPART_EXPR, arg);
+  addend2 = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
+   imag_part, imag_part);
+  sum = build_and_insert_binop (gsi, loc, target, PLUS_EXPR, addend1, addend2);
+  result = build_and_insert_call (gsi, loc, &target, sqrtfn, sum);
+
+  return result;
+}
+
 /* 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.  */
@@ -1388,6 +1440,21 @@ execute_cse_sincos (void)
}
  break;
 
+   CASE_FLT_FN (BUILT_IN_CABS):
+ arg0 = gimple_call_arg (stmt, 0);
+ loc = gimple_location (stmt);
+ result = gimple_expand_builtin_cabs (&gsi, loc, arg0);
+
+ 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;
+
default:;
}
}




Re: Typed DWARF stack and convert to untyped

2011-06-09 Thread Jakub Jelinek
On Thu, Jun 09, 2011 at 04:53:19PM +0200, Jakub Jelinek wrote:
> I'd like to propose convert to untyped operation, e.g.
> DW_OP_GNU_convert <0> could do it (and maybe DW_OP_GNU_reinterpret <0>),
> these would convert to an integral value of the same size as DWARF
> address and make it untyped.  As DW_OP_GNU_convert operand is
> uleb128 DIE offset within current CU, offset 0 certainly won't
> contain any DIEs, because it is the first byte of the CU header.

And here is a rough patch that implements it, in case you agree
with that (and also switches from defaulting to signed types to defaulting
to unsigned types, as those have defined overflow for say
addition/subtraction etc.).  Untested so far.
Testcase where the convert to untyped is used is e.g.:
void foo (unsigned long long a, unsigned long long b)
{
  unsigned long long c = a / b;
  long long d = c;
  long long e = d % 17;
}
Although long is <= DWARF2_ADDR_SIZE here, for unsigned division we have
to change the arguments to typed unsigned 64-bit, then DW_OP_div,
and then we just used to convert to typed signed 64-bit and mod
was performed with the other argument DW_OP_lit17 instead of
DW_OP_const_type  <17>.  With the patch
the result of DW_OP_div is converted to untyped and the rest is performed
in untyped.

2011-06-09  Jakub Jelinek  

* dwarf2out.c (size_of_loc_descr, output_loc_operands,
mark_base_types, hash_loc_operands, compare_loc_operands): Allow
DW_OP_GNU_convert and DW_OP_GNU_reinterpret to use constant instead
of base type reference as argument.
(resolve_addr_in_expr): Likewise.  Fix keep computation.
(convert_descriptor_to_signed): Renamed to...
(convert_descriptor_to_mode): ... this.  For wider types convert
to unsigned instead of signed, for <= DWARF2_ADDR_SIZE convert to
untyped.
(typed_binop): New function.
(scompare_loc_descriptor, ucompare_loc_descriptor,
minmax_loc_descriptor, mem_loc_descriptor): For wider integer modes
default to unsigned type instead of signed.

--- gcc/dwarf2out.c.jj  2011-06-09 16:56:50.0 +0200
+++ gcc/dwarf2out.c 2011-06-09 19:15:26.0 +0200
@@ -5076,11 +5076,15 @@ size_of_loc_descr (dw_loc_descr_ref loc)
   break;
 case DW_OP_GNU_convert:
 case DW_OP_GNU_reinterpret:
-  {
-   unsigned long o
- = get_base_type_offset (loc->dw_loc_oprnd1.v.val_die_ref.die);
-   size += size_of_uleb128 (o);
-  }
+  if (loc->dw_loc_oprnd1.val_class == dw_val_class_unsigned_const)
+   size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
+  else
+   {
+ unsigned long o
+   = get_base_type_offset (loc->dw_loc_oprnd1.v.val_die_ref.die);
+ size += size_of_uleb128 (o);
+   }
+  break;
 default:
   break;
 }
@@ -5456,11 +5460,14 @@ output_loc_operands (dw_loc_descr_ref lo
   break;
 case DW_OP_GNU_convert:
 case DW_OP_GNU_reinterpret:
-  {
-   unsigned long o = get_base_type_offset (val1->v.val_die_ref.die);
-   gcc_assert (o);
-   dw2_asm_output_data_uleb128 (o, NULL);
-  }
+  if (loc->dw_loc_oprnd1.val_class == dw_val_class_unsigned_const)
+   dw2_asm_output_data_uleb128 (val1->v.val_unsigned, NULL);
+  else
+   {
+ unsigned long o = get_base_type_offset (val1->v.val_die_ref.die);
+ gcc_assert (o);
+ dw2_asm_output_data_uleb128 (o, NULL);
+   }
   break;
 
 default:
@@ -13824,27 +13831,24 @@ base_type_for_mode (enum machine_mode mo
   return type_die;
 }
 
-/* For OP descriptor assumed to be in unsigned MODE, convert it to a signed
-   type matching MODE, or, if MODE is narrower than DWARF2_ADDR_SIZE, signed
-   type matching DWARF2_ADDR_SIZE.  Return NULL if the conversion is not
+/* For OP descriptor assumed to be in unsigned MODE, convert it to a unsigned
+   type matching MODE, or, if MODE is narrower than or as wide as
+   DWARF2_ADDR_SIZE, untyped.  Return NULL if the conversion is not
possible.  */
 
 static dw_loc_descr_ref
-convert_descriptor_to_signed (enum machine_mode mode, dw_loc_descr_ref op)
+convert_descriptor_to_mode (enum machine_mode mode, dw_loc_descr_ref op)
 {
   enum machine_mode outer_mode = mode;
   dw_die_ref type_die;
   dw_loc_descr_ref cvt;
 
-  if (GET_MODE_SIZE (mode) < DWARF2_ADDR_SIZE)
+  if (GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE)
 {
-  outer_mode = mode_for_size (DWARF2_ADDR_SIZE * BITS_PER_UNIT,
- MODE_INT, 0);
-  if (outer_mode == BLKmode
- || GET_MODE_SIZE (outer_mode) != DWARF2_ADDR_SIZE)
-   return NULL;
+  add_loc_descr (&op, new_loc_descr (DW_OP_GNU_convert, 0, 0));
+  return op;
 }
-  type_die = base_type_for_mode (outer_mode, 0);
+  type_die = base_type_for_mode (outer_mode, 1);
   if (type_die == NULL)
 return NULL;
   cvt = new_loc_descr (DW_OP_GNU_convert, 0, 0);
@@ -13901,9 +13905,29 @@ scompare_loc_descrip

[pph] New script to reproduce failures from a .log file (issue4601050)

2011-06-09 Thread Diego Novillo
This small script searches for the spawn line corresponding to a given
grep pattern inside a dejagnu log file.  If it finds the spawn line,
it executes it with any other arguments provided on the command line.

It's generally useful for cutting and pasting failed test cases.  I did
not find anything close to it in gcc/contrib, so I will be adding it
to trunk shortly.

Gab, Lawrence, this ought to simplify reproducing pph failures from
g++.log.  Feel free to add more functionality to it, or use it to
find writer and reader pairs in the log file and execute them separately.


Diego.


* repro_fail: New.

diff --git a/contrib/repro_fail b/contrib/repro_fail
new file mode 100755
index 000..d5bce04
--- /dev/null
+++ b/contrib/repro_fail
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Script to reproduce a test failure from a dejagnu .log file
+#
+# Contributed by Diego Novillo 
+#
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+if [ $# -lt 2 ] ; then
+echo "usage: $0 pattern file.log [additional-args]"
+echo
+echo "Finds the 'spawn' line matching PATTERN in FILE.LOG and executes"
+echo "the command with any arguments in ADDITIONAL-ARGS."
+echo
+exit 1
+fi
+
+set -e
+pattern=$1
+logf=$2
+shift 2
+args="$@"
+line=$(grep "^spawn .*$pattern" $logf | sed -e "s:^spawn ::")
+
+if [ "$line" = "" ] ; then
+echo "Could not find a spawn command for pattern $1"
+exit 1
+fi
+
+set -x +e
+$line $args
+exit $?

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


Re: [Patch, AVR]: Fix PR46779

2011-06-09 Thread Denis Chertykov
2011/6/9 Georg-Johann Lay :
> This is a tentative patch to fix PR46779 and hopefully also related
> issues like PR45291.
>
-  /* Disallow QImode in stack pointer regs.  */
-  if ((regno == REG_SP || regno == (REG_SP + 1)) && mode == QImode)
+  /* Don't allocate data to non-GENERAL_REGS registers.  */
+
+  if (regno >= 32)
     return 0;

I think that we not need in this code.
GCC core must bother about this.

+
+  if (GET_MODE_SIZE (mode) == 1)
     return 1;

I'm agree with this.

+
+  /* Disallow big registers that overlap the frame pointer.
+     This will hopefully reduce the number of spill failures.  */
+
+  if (GET_MODE_SIZE (mode) > 2
+      && regno <= REG_Y
+      && regno + GET_MODE_SIZE (mode) >= REG_Y + 1)
+    {
+      return 0;
+    }

Fragment from GCC info:
--
HARD_REGNO_MODE_OK (regno, mode)A C expression that is nonzero if it
is permissible to store a value of mode mode in hard register number
regno (or in several registers starting with that one). For a machine
where all registers are equivalent, a suitable definition is

#define HARD_REGNO_MODE_OK(REGNO, MODE) 1

You need not include code to check for the numbers of fixed registers,
because the allocation mechanism considers them to be always occupied.
-
Again, GCC core must bother about this.

-  /* Otherwise disallow all regno/mode combinations that span r28:r29.  */
-  if (regno <= (REG_Y + 1) && (regno + GET_MODE_SIZE (mode)) >= (REG_Y + 1))
-    return 0;
-
-  if (mode == QImode)
-    return 1;
-
-  /* Modes larger than QImode occupy consecutive registers.  */
-  if (regno + GET_MODE_SIZE (mode) > FIRST_PSEUDO_REGISTER)
-    return 0;
-

This is a right change.

Denis.


Re: [lto, testsuite] Don't use visibility on targets that don't support it (PR lto/47334)

2011-06-09 Thread Mike Stump
On Jun 9, 2011, at 12:14 AM, Rainer Orth wrote:
> Mike Stump  writes:
>> On Apr 5, 2011, at 1:56 AM, Rainer Orth wrote:
>>> * lto.c (promote_var): Only set VISIBILITY_HIDDEN if
>>> HAVE_GAS_HIDDEN.
>> 
>> This looks wrong, there are more things that have visibility than those 
>> things that use GAS and have .hidden.  Darwin I think is one of them.  ?  
>> cygming.h seems to be another.
> 
> Now that Darwin has been switched to define HAVE_GAS_HIDDEN, is the
> lto.c part ok?

I don't have any lto specific objections related to this.


[pph] Do not emit PCH if generating PPH (issue4591061)

2011-06-09 Thread Diego Novillo

We were trying to generate PCH and PPH information at the same time.
We never noticed because PPH is generated after PCH, so we were just
clobbering over the previous dump.

Found it by accident while debugging a GC ICE.  This should make
testing slightly faster.

Committed to the branch.



* lang-specs.h (@c++-header): Do not emit PCH if any -fpph flag is
present.

diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index a73aba3..9943446 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -48,8 +48,8 @@ along with GCC; see the file COPYING3.  If not see
   cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed 
%{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
%(cc1_options) %2\
-   %{!fsyntax-only:%{!fdump-ada-spec*:-o %g.s %{!o*:--output-pch=%i.gch}\
-%W{o*:--output-pch=%*}}%V",
+   %{!fsyntax-only:%{!fpph*:%{!fdump-ada-spec*:-o %g.s 
%{!o*:--output-pch=%i.gch}\
+%W{o*:--output-pch=%*}}}%V",
  CPLUSPLUS_CPP_SPEC, 0, 0},
   {"@c++",
 "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}\

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


[Patch, AVR]: Fix thinko in avr_function_arg_advance

2011-06-09 Thread Georg-Johann Lay
This patch fixes a thinko in avr_function_arg_advance.

Without the patch, following code will report false positive for
passing args in fixed regs like:

error: Register r0 is needed to pass a parameter but is fixed
error: Register r1 is needed to pass a parameter but is fixed

This is the code:

typedef struct
{
char c[18];
} S;

typedef struct
{
char c[26];
} T;

char foo (S b, T a)
{
return b.c[9];
}

The patch also uses same constraint for cfun->machine->sibcall_fails
(even though it would not hut to have false positived there).

Johann

--
* config/avr/avr.c (avr_function_arg_advance): Fix thinko about
when a value is actually passed in regs.

Index: config/avr/avr.c
===
--- config/avr/avr.c	(Revision 174701)
+++ config/avr/avr.c	(Arbeitskopie)
@@ -1784,7 +1784,8 @@ avr_function_arg_advance (CUMULATIVE_ARG
  a function must not pass arguments in call-saved regs in order to get
  tail-called. */
   
-  if (cum->regno >= 0
+  if (cum->regno >= 8
+  && cum->nregs >= 0
   && !call_used_regs[cum->regno])
 {
   /* FIXME: We ship info on failing tail-call in struct machine_function.
@@ -1800,7 +1801,8 @@ avr_function_arg_advance (CUMULATIVE_ARG
  user has fixed a GPR needed to pass an argument, an (implicit) function
  call would clobber that fixed register.  See PR45099 for an example.  */
   
-  if (cum->regno >= 0)
+  if (cum->regno >= 8
+  && cum->nregs >= 0)
 {
   int regno;
 


Re: [Patch, AVR]: Fix thinko in avr_function_arg_advance

2011-06-09 Thread Denis Chertykov
2011/6/9 Georg-Johann Lay :
> This patch fixes a thinko in avr_function_arg_advance.
>
> Without the patch, following code will report false positive for
> passing args in fixed regs like:
>
> error: Register r0 is needed to pass a parameter but is fixed
> error: Register r1 is needed to pass a parameter but is fixed
>
> This is the code:
>
> typedef struct
> {
>    char c[18];
> } S;
>
> typedef struct
> {
>    char c[26];
> } T;
>
> char foo (S b, T a)
> {
>    return b.c[9];
> }
>
> The patch also uses same constraint for cfun->machine->sibcall_fails
> (even though it would not hut to have false positived there).

Approved.

Denis.


Re: [PATCH] Un-obsolete Interix

2011-06-09 Thread Joseph S. Myers
Why are you adding an include of  to i386-interix.h?  This header 
(and most common system headers) should generally be included via system.h 
on the host, or tsystem.h on the target, not directly.

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


Re: First Patch

2011-06-09 Thread Tobias Burnus

Daniel Carrera wrote:

I think I understand the problem. We have:


  if (count == 0 || (count == 1 && images[0] == caf_this_image))
*stat = 0;


Well, you could have kept the return:

   if (count == 0 || (count == 1&&  images[0] == caf_this_image))
-return 0;
+*stat = 0;


Tobias


Re: [PATCH] Un-obsolete Interix

2011-06-09 Thread Douglas B Rupp

Unneeded and removed.
Also found some trailing spaces in i386-interix.h, now removed.

On 6/9/2011 12:02 PM, Joseph S. Myers wrote:

Why are you adding an include of  to i386-interix.h?  This header
(and most common system headers) should generally be included via system.h
on the host, or tsystem.h on the target, not directly.





Re: [Patch, AVR]: Fix PR46779

2011-06-09 Thread Georg-Johann Lay
Denis Chertykov schrieb:
> 2011/6/9 Georg-Johann Lay :
>> This is a tentative patch to fix PR46779 and hopefully also related
>> issues like PR45291.
>>
> -  /* Disallow QImode in stack pointer regs.  */
> -  if ((regno == REG_SP || regno == (REG_SP + 1)) && mode == QImode)
> +  /* Don't allocate data to non-GENERAL_REGS registers.  */
> +
> +  if (regno >= 32)
>  return 0;
> 
> I think that we not need in this code.
> GCC core must bother about this.

I am unsure about that. There is the "q" constraint that is used for
SP. register_operand will accept SP because regno_reg_class does not
return NO_REGS for SP. So something must stop the register allocator
from allocating ordinary data to SP.

In the current md there is "*movhi_sp" insn prior to "*movhi" insn.
Besides that it is strongly discouraged to have more than one move
insn for one mode, not each and every place looks at insn conditions.

Moreover, if there is an insn like
(set (reg:HI 100)
 (reg:HI 101))
that matches "*movhi", what will keep IRA from allocating one of the
values to SP, i.e. chose alternative "q,r" or "r,q"?

> +
> +  if (GET_MODE_SIZE (mode) == 1)
>  return 1;
> 
> I'm agree with this.

> +  /* Disallow big registers that overlap the frame pointer.
> + This will hopefully reduce the number of spill failures.  */
> +
> +  if (GET_MODE_SIZE (mode) > 2
> +  && regno <= REG_Y
> +  && regno + GET_MODE_SIZE (mode) >= REG_Y + 1)
> +{
> +  return 0;
> +}
> 
> Fragment from GCC info:
> --
> HARD_REGNO_MODE_OK (regno, mode)A C expression that is nonzero if it
> is permissible to store a value of mode mode in hard register number
> regno (or in several registers starting with that one). For a machine
> where all registers are equivalent, a suitable definition is
> 
> #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
> 
> You need not include code to check for the numbers of fixed registers,
> because the allocation mechanism considers them to be always occupied.
> -
> Again, GCC core must bother about this.

I agree with you. However, I think that the risk of spill failure
should be minimized. I have no idea how to fix a splill failure like
the following that occurs in testsuite (with -Os, no matter if the
patch is applied or not):

./gcc/testsuite/gcc.c-torture/execute/pr38051.c:189:1: error: unable
to find a register to spill in class 'POINTER_REGS'
./gcc/testsuite/gcc.c-torture/execute/pr38051.c:189:1: error: this is
the insn:
(insn 61 60 62 10 (set (reg/v:SI 12 r12 [orig:73 b0 ] [73])
(mem:SI (subreg:HI (reg/v:SI 70 [ srcp2 ]) 0) [2 *D.2218_56+0
S4 A8])) ./gcc/testsuite/gcc.c-torture/execute/pr38051.c:64 12 {*movsi}
 (nil))
./gcc/testsuite/gcc.c-torture/execute/pr38051.c:189:1: internal
compiler error: in spill_failure, at reload1.c:2113

Actually I have no idea if the snip in avr_hard_regno_mode_ok actually
would reduce the risk of spill failure :-/

> -  /* Otherwise disallow all regno/mode combinations that span r28:r29.  */
> -  if (regno <= (REG_Y + 1) && (regno + GET_MODE_SIZE (mode)) >= (REG_Y + 1))
> -return 0;
> -
> -  if (mode == QImode)
> -return 1;
> -
> -  /* Modes larger than QImode occupy consecutive registers.  */
> -  if (regno + GET_MODE_SIZE (mode) > FIRST_PSEUDO_REGISTER)
> -return 0;
> -
> 
> This is a right change.
> 
> Denis.

Johann



Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))

2011-06-09 Thread Jason Merrill

On 06/07/2011 10:24 AM, Jason Merrill wrote:

On 06/07/2011 10:05 AM, Richard Guenther wrote:

In that case you could do what Jakub suggested - but only for rvalues
of course.


Right, and I need to handle lvalues as well.


Can't you instead adjust the type you feed to fold_indirect_ref_1 in
the caller in the C++ FE?


Not without digging down into the operand to see what type it wants. At
that point I might as well just copy the whole function into the FE.


Ping?

Jason


Re: [Patch, AVR]: Fix PR46779

2011-06-09 Thread Denis Chertykov
2011/6/9 Georg-Johann Lay :
> Denis Chertykov schrieb:
>> 2011/6/9 Georg-Johann Lay :
>>> This is a tentative patch to fix PR46779 and hopefully also related
>>> issues like PR45291.
>>>
>> -  /* Disallow QImode in stack pointer regs.  */
>> -  if ((regno == REG_SP || regno == (REG_SP + 1)) && mode == QImode)
>> +  /* Don't allocate data to non-GENERAL_REGS registers.  */
>> +
>> +  if (regno >= 32)
>>      return 0;
>>
>> I think that we not need in this code.
>> GCC core must bother about this.
>
> I am unsure about that. There is the "q" constraint that is used for
> SP. register_operand will accept SP because regno_reg_class does not
> return NO_REGS for SP. So something must stop the register allocator
> from allocating ordinary data to SP.

I know, this is a FIXED_REGISTERS.

> In the current md there is "*movhi_sp" insn prior to "*movhi" insn.
> Besides that it is strongly discouraged to have more than one move
> insn for one mode, not each and every place looks at insn conditions.

I'm agree. May be better to rewrite it.

>
> Moreover, if there is an insn like
> (set (reg:HI 100)
>     (reg:HI 101))
> that matches "*movhi", what will keep IRA from allocating one of the
> values to SP, i.e. chose alternative "q,r" or "r,q"?

FIXED_REGISTERS.

>> +    {
>> +      return 0;
>> +    }
>>
>> Fragment from GCC info:
>> --
>> HARD_REGNO_MODE_OK (regno, mode)A C expression that is nonzero if it
>> is permissible to store a value of mode mode in hard register number
>> regno (or in several registers starting with that one). For a machine
>> where all registers are equivalent, a suitable definition is
>>
>> #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
>>
>> You need not include code to check for the numbers of fixed registers,
>> because the allocation mechanism considers them to be always occupied.
>> -
>> Again, GCC core must bother about this.
>
> I agree with you. However, I think that the risk of spill failure
> should be minimized. I have no idea how to fix a splill failure like
> the following that occurs in testsuite (with -Os, no matter if the
> patch is applied or not):
>
> ./gcc/testsuite/gcc.c-torture/execute/pr38051.c:189:1: error: unable
> to find a register to spill in class 'POINTER_REGS'
> ./gcc/testsuite/gcc.c-torture/execute/pr38051.c:189:1: error: this is
> the insn:
> (insn 61 60 62 10 (set (reg/v:SI 12 r12 [orig:73 b0 ] [73])
>        (mem:SI (subreg:HI (reg/v:SI 70 [ srcp2 ]) 0) [2 *D.2218_56+0
> S4 A8])) ./gcc/testsuite/gcc.c-torture/execute/pr38051.c:64 12 {*movsi}
>     (nil))
> ./gcc/testsuite/gcc.c-torture/execute/pr38051.c:189:1: internal
> compiler error: in spill_failure, at reload1.c:2113
>
> Actually I have no idea if the snip in avr_hard_regno_mode_ok actually
> would reduce the risk of spill failure :-/

I think, no.
I will try to debug reload for pr38051.c (It will be a long process 1-2 weeks)

Denis.


Re: [Patch, AVR]: Fix PR46779

2011-06-09 Thread Georg-Johann Lay

Georg-Johann Lay schrieb:

Denis Chertykov schrieb:


2011/6/9 Georg-Johann Lay :


This is a tentative patch to fix PR46779 and hopefully also related
issues like PR45291.



-  /* Disallow QImode in stack pointer regs.  */
-  if ((regno == REG_SP || regno == (REG_SP + 1)) && mode == QImode)
+  /* Don't allocate data to non-GENERAL_REGS registers.  */
+
+  if (regno >= 32)
return 0;

I think that we not need in this code.
GCC core must bother about this.



I am unsure about that. There is the "q" constraint that is used for
SP. register_operand will accept SP because regno_reg_class does not
return NO_REGS for SP. So something must stop the register allocator
from allocating ordinary data to SP.

In the current md there is "*movhi_sp" insn prior to "*movhi" insn.
Besides that it is strongly discouraged to have more than one move
insn for one mode, not each and every place looks at insn conditions.

Moreover, if there is an insn like
(set (reg:HI 100)
 (reg:HI 101))
that matches "*movhi", what will keep IRA from allocating one of the
values to SP, i.e. chose alternative "q,r" or "r,q"?


Ok, SP is a fixed register, I missed that above :-)

For the "*movhi_sp" I will provide a patch too as soon as I find the time.

Johann


Re: [SPARC] Fix another thinko

2011-06-09 Thread Eric Botcazou
> 2011-06-05  Eric Botcazou  
>
>   * config/sparc/sparc.c (output_return): Fix thinko in the output of an
>   EH return when delayed branches are disabled.

Of course the length attribute needs to be adjusted as well.

Tested on SPARC/Solaris 8, applied on the mainline and 4.6/4.5/4.4 branches.


2011-06-09  Eric Botcazou  

* config/sparc/sparc.md (return_internal): Adjust 'length' attribute.


-- 
Eric Botcazou
Index: config/sparc/sparc.md
===
--- config/sparc/sparc.md	(revision 174014)
+++ config/sparc/sparc.md	(working copy)
@@ -6322,9 +6322,7 @@ (define_insn "*return_internal"
 			   (if_then_else (eq_attr "isa" "v9")
 	 (const_int 2)
 	 (const_int 3))
-			   (if_then_else (eq_attr "isa" "v9")
-	 (const_int 3)
-	 (const_int 4)))
+			   (const_int 4))
 	   (eq_attr "empty_delay_slot" "true")
 		 (if_then_else (eq_attr "delayed_branch" "true")
 			   (const_int 2)


Re: [PATCH] Remove set_sizetype

2011-06-09 Thread Eric Botcazou
> 2011-06-09  Richard Guenther  
>
>   * stor-layout.c (initialize_sizetypes): Give names to all
>   sizetype kinds.

Thanks!

-- 
Eric Botcazou


[google] cprop pass's gate function cleanup (issue4572055)

2011-06-09 Thread David Li
The patch fixed the breakage due to the r174848 backport to google/main --
the gate function for cprop is in a different file from trunk.

2011-06-09  David Li  

* gcse.c (gate_rtl_cprop): Gate cleanup
(execute_rtl_cprop): Gate cleanup

Index: gcse.c
===
--- gcse.c  (revision 174852)
+++ gcse.c  (working copy)
@@ -5309,15 +5309,17 @@ one_cprop_pass (void)
 static bool
 gate_rtl_cprop (void)
 {
-  return optimize > 0 && flag_gcse
-&& !cfun->calls_setjmp
-&& dbg_cnt (cprop);
+  return optimize > 0 && flag_gcse;
 }
 
 static unsigned int
 execute_rtl_cprop (void)
 {
   int changed;
+  if (cfun->calls_setjmp
+  || !dbg_cnt (cprop))
+return 0;
+
   delete_unreachable_blocks ();
   df_set_flags (DF_LR_RUN_DCE);
   df_analyze ();

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


Re: [pph] New script to reproduce failures from a .log file (issue4601050)

2011-06-09 Thread Lawrence Crowl
On 6/9/11, Diego Novillo  wrote:
> This small script searches for the spawn line corresponding to a given
> grep pattern inside a dejagnu log file.  If it finds the spawn line,
> it executes it with any other arguments provided on the command line.
>
> It's generally useful for cutting and pasting failed test cases.  I did
> not find anything close to it in gcc/contrib, so I will be adding it
> to trunk shortly.
>
> Gab, Lawrence, this ought to simplify reproducing pph failures from
> g++.log.  Feel free to add more functionality to it, or use it to
> find writer and reader pairs in the log file and execute them separately.
>
>
> Diego.
>
>
>   * repro_fail: New.
>
> diff --git a/contrib/repro_fail b/contrib/repro_fail
> new file mode 100755
> index 000..d5bce04
> --- /dev/null
> +++ b/contrib/repro_fail
> @@ -0,0 +1,49 @@
> +#!/bin/bash
> +#
> +# Script to reproduce a test failure from a dejagnu .log file
> +#
> +# Contributed by Diego Novillo 
> +#
> +# Copyright (C) 2011 Free Software Foundation, Inc.
> +#
> +# This file is part of GCC.
> +#
> +# GCC is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3, or (at your option)
> +# any later version.
> +#
> +# GCC is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with GCC; see the file COPYING.  If not, write to
> +# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
> +# Boston, MA 02110-1301, USA.
> +
> +if [ $# -lt 2 ] ; then
> +echo "usage: $0 pattern file.log [additional-args]"
> +echo
> +echo "Finds the 'spawn' line matching PATTERN in FILE.LOG and executes"
> +echo "the command with any arguments in ADDITIONAL-ARGS."
> +echo
> +exit 1
> +fi
> +
> +set -e
> +pattern=$1
> +logf=$2
> +shift 2
> +args="$@"
> +line=$(grep "^spawn .*$pattern" $logf | sed -e "s:^spawn ::")

line=$(sed -e "/^spawn .*$pattern/ ! d ; s/^spawn //" $logf)

Has one fewer process and one fewer pipe.  Sed is your friend.

I think this code fails when multiple lines match the pattern.
Pipe through head?

> +
> +if [ "$line" = "" ] ; then
> +echo "Could not find a spawn command for pattern $1"
> +exit 1
> +fi
> +
> +set -x +e
> +$line $args
> +exit $?
>
> --
> This patch is available for review at http://codereview.appspot.com/4601050
>


-- 
Lawrence Crowl


[patch libgcc committed]: Fix missing include of windows.h for mingw targets

2011-06-09 Thread Kai Tietz
Hello,

by recent changes about HAVE_ENABLE_EXECUTE_STACK and moving code into
libgcc2.c the necessary header include of windows.h was removed for
config/i386/mingw32.h for LIBGCC2 case.  This header is necessary for
trampoline code in libgcc2.c, as for mingw target platform API is
used.

ChangeLog

* libgcc2.c (L_trampoline): Include windows.h for mingw targets.

Patch tested and applied at  revision 174860.

Regards,
Kai

Index: libgcc2.c
===
--- libgcc2.c   (revision 174854)
+++ libgcc2.c   (working copy)
@@ -2032,6 +2032,7 @@
 /* Jump to a trampoline, loading the static chain address.  */

 #if defined(WINNT) && ! defined(__CYGWIN__)
+#include 
 int getpagesize (void);
 int mprotect (char *,int, int);


Re: [pph] New script to reproduce failures from a .log file (issue4601050)

2011-06-09 Thread Diego Novillo
On Thu, Jun 9, 2011 at 13:48, Lawrence Crowl  wrote:

>
> line=$(sed -e "/^spawn .*$pattern/ ! d ; s/^spawn //" $logf)
>
> Has one fewer process and one fewer pipe.  Sed is your friend.

sed and I have a complicated relationship.  But, sure :)

> I think this code fails when multiple lines match the pattern.
> Pipe through head?

Yup.  It does.

I'm sure there will be other things, it's in contrib/ now.  I'll wait
until we've used it and expanded it a bit more and move it to trunk.


Diego.


Re: -fdump-passes -fenable-xxx=func_name_list

2011-06-09 Thread H.J. Lu
On Tue, Jun 7, 2011 at 11:54 AM, Xinliang David Li  wrote:
> Please review the attached two patches.
>
> In the first patch, gate functions are cleaned up. All the per
> function legality checks are moved into the executor and the
> optimization heuristic checks (optimize for size) remain in the
> gators. These allow the the following overriding order:
>
>    common flags (O2, -ftree-vrp, -fgcse etc)   <---  compiler
> heuristic (optimize for size/speed) <--- -fdisable/enable forcing pass
> options  <--- legality check
>
> Testing under going. Ok for trunk?
>

This caused:

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

-- 
H.J.


Re: -fdump-passes -fenable-xxx=func_name_list

2011-06-09 Thread Carrot Wei
It also breaks arm backend.

../trunk/configure '--build=x86_64-build_pc-linux-gnu'
'--host=x86_64-build_pc-linux-gnu'
'--target=arm-unknown-linux-gnueabi'
'--with-sysroot=/home/carrot/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys-root'
'--disable-multilib' '--with-float=soft' '--disable-sjlj-exceptions'
'--enable-__cxa_atexit' '--disable-nls' '--enable-threads=posix'
'--enable-symvers=gnu' '--enable-c99' '--enable-long-long'
'--enable-target-optspace' '--disable-bootstrap'
'build_alias=x86_64-build_pc-linux-gnu'
'host_alias=x86_64-build_pc-linux-gnu'
'target_alias=arm-unknown-linux-gnueabi'
'--enable-languages=c,c++,lto'

make

...

/bin/sh ../libtool --tag CXX   --mode=compile
/usr/local/google/home/carrot/armobj1/./gcc/xgcc -shared-libgcc
-B/usr/local/google/home/carrot/armobj1/./gcc -nostdinc++
-L/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/src
-L/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/src/.libs
-B/usr/local/arm-unknown-linux-gnueabi/bin/
-B/usr/local/arm-unknown-linux-gnueabi/lib/ -isystem
/usr/local/arm-unknown-linux-gnueabi/include -isystem
/usr/local/arm-unknown-linux-gnueabi/sys-include
-I/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/include/arm-unknown-linux-gnueabi
-I/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/include
-I/usr/local/google/home/carrot/trunk/libstdc++-v3/libsupc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual
-fdiagnostics-show-location=once  -ffunction-sections -fdata-sections
-g -Os 
-I/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/include/backward
-Wno-deprecated -c ../../../../trunk/libstdc++-v3/src/strstream.cc
libtool: compile:  /usr/local/google/home/carrot/armobj1/./gcc/xgcc
-shared-libgcc -B/usr/local/google/home/carrot/armobj1/./gcc
-nostdinc++ 
-L/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/src
-L/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/src/.libs
-B/usr/local/arm-unknown-linux-gnueabi/bin/
-B/usr/local/arm-unknown-linux-gnueabi/lib/ -isystem
/usr/local/arm-unknown-linux-gnueabi/include -isystem
/usr/local/arm-unknown-linux-gnueabi/sys-include
-I/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/include/arm-unknown-linux-gnueabi
-I/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/include
-I/usr/local/google/home/carrot/trunk/libstdc++-v3/libsupc++
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual
-fdiagnostics-show-location=once -ffunction-sections -fdata-sections
-g -Os 
-I/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/include/backward
-Wno-deprecated -c ../../../../trunk/libstdc++-v3/src/strstream.cc
-fPIC -DPIC -o .libs/strstream.o
In file included from ../../../../trunk/libstdc++-v3/src/strstream.cc:45:0:
/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/include/backward/strstream:
In member function 'void*
std::strstream::_ZTv0_n12_NSt9strstreamD1Ev()':
/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/include/backward/strstream:171:13:
internal compiler error: in verify_curr_properties, at passes.c:1660
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
make[4]: *** [strstream.lo] Error 1
make[4]: Leaving directory
`/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory
`/usr/local/google/home/carrot/armobj1/arm-unknown-linux-gnueabi/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/usr/local/google/home/carrot/armobj1'
make: *** [all] Error 2


On Fri, Jun 10, 2011 at 6:05 AM, H.J. Lu  wrote:
> On Tue, Jun 7, 2011 at 11:54 AM, Xinliang David Li  wrote:
>> Please review the attached two patches.
>>
>> In the first patch, gate functions are cleaned up. All the per
>> function legality checks are moved into the executor and the
>> optimization heuristic checks (optimize for size) remain in the
>> gators. These allow the the following overriding order:
>>
>>    common flags (O2, -ftree-vrp, -fgcse etc)   <---  compiler
>> heuristic (optimize for size/speed) <--- -fdisable/enable forcing pass
>> options  <--- legality check
>>
>> Testing under going. Ok for trunk?
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49350
>
> --
> H.J.
>


Re: -fdump-passes -fenable-xxx=func_name_list

2011-06-09 Thread Xinliang David Li
Can you send me a trace? I can not reproduce the problem.

David


On Thu, Jun 9, 2011 at 3:05 PM, H.J. Lu  wrote:
> On Tue, Jun 7, 2011 at 11:54 AM, Xinliang David Li  wrote:
>> Please review the attached two patches.
>>
>> In the first patch, gate functions are cleaned up. All the per
>> function legality checks are moved into the executor and the
>> optimization heuristic checks (optimize for size) remain in the
>> gators. These allow the the following overriding order:
>>
>>    common flags (O2, -ftree-vrp, -fgcse etc)   <---  compiler
>> heuristic (optimize for size/speed) <--- -fdisable/enable forcing pass
>> options  <--- legality check
>>
>> Testing under going. Ok for trunk?
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49350
>
> --
> H.J.
>


[patch committed] Fix PR target/49307

2011-06-09 Thread Kaz Kojima
Hi,

The attached patch is to fix PR target/49307.  In the faulty case,
protector inserts PIC codes after the result register R0 is set
and IRA combines a few of them into a load from a memory which
needs R0 to spill.  The patch use a unspec and an insn_and_split to
hide the above PIC codes from IRA and other early passes to avoid
this unexpected combining.  Tested on sh4-unknown-linux-gnu with no
new failures.  I've added a dg testcase which is tested also on
i686-pc-linux-gnu.  Applied on trunk.

I'll backport this patch to 4.5/4.6 branches since this PR is
a regression on those branches.

Regards,
kaz
--
2011-06-09  Kaz Kojima  

PR target/49307
* config/sh/sh.md (UNSPEC_CHKADD): New.
(chk_guard_add): New define_insn_and_split.
(symGOT_load): Use chk_guard_add instead of blockage.

[testsuite]
PR target/49307
* gcc.dg/pr49307.c: New.

diff -uprN ORIG/trunk/gcc/config/sh/sh.md trunk/gcc/config/sh/sh.md
--- ORIG/trunk/gcc/config/sh/sh.md  2010-08-28 13:32:01.0 +0900
+++ trunk/gcc/config/sh/sh.md   2011-06-08 14:32:11.0 +0900
@@ -150,6 +150,7 @@
   (UNSPEC_DIV_INV_TABLE37)
   (UNSPEC_ASHIFTRT 35)
   (UNSPEC_THUNK36)
+  (UNSPEC_CHKADD   38)
   (UNSPEC_SP_SET   40)
   (UNSPEC_SP_TEST  41)
   (UNSPEC_MOVUA42)
@@ -8454,6 +8455,22 @@ label:
   i++;
 }")
 
+;; op0 = op1 + r12 but hide it before reload completed.  See the comment
+;; in symGOT_load expand.
+
+(define_insn_and_split "chk_guard_add"
+  [(set (match_operand:SI 0 "register_operand" "=&r")
+   (unspec:SI [(match_operand:SI 1 "register_operand" "r")
+   (reg:SI PIC_REG)]
+  UNSPEC_CHKADD))]
+  "TARGET_SH1"
+  "#"
+  "TARGET_SH1 && reload_completed"
+  [(set (match_dup 0) (reg:SI PIC_REG))
+   (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))]
+  ""
+  [(set_attr "type" "arith")])
+
 (define_expand "sym_label2reg"
   [(set (match_operand:SI 0 "" "")
(const:SI (unspec:SI [(match_operand:SI 1 "" "")
@@ -8496,13 +8513,9 @@ label:
   else
 emit_move_insn (operands[2], operands[1]);
 
-  emit_move_insn (operands[3], gen_rtx_PLUS (Pmode,
-operands[2],
-gen_rtx_REG (Pmode, PIC_REG)));
-
   /* When stack protector inserts codes after the result is set to
- R0, @(rX, r12) will cause a spill failure for R0.  Don't schedule
- insns to avoid combining (set A (plus rX r12)) and (set op0 (mem A))
+ R0, @(rX, r12) will cause a spill failure for R0.  Use a unspec
+ insn to avoid combining (set A (plus rX r12)) and (set op0 (mem A))
  when rX is a GOT address for the guard symbol.  Ugly but doesn't
  matter because this is a rare situation.  */
   if (!TARGET_SHMEDIA
@@ -8512,7 +8525,10 @@ label:
   && GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == SYMBOL_REF
   && strcmp (XSTR (XVECEXP (XEXP (operands[1], 0), 0, 0), 0),
 \"__stack_chk_guard\") == 0)
-emit_insn (gen_blockage ());
+emit_insn (gen_chk_guard_add (operands[3], operands[2]));
+  else
+emit_move_insn (operands[3], gen_rtx_PLUS (Pmode, operands[2],
+  gen_rtx_REG (Pmode, PIC_REG)));
 
   /* N.B. This is not constant for a GOTPLT relocation.  */
   mem = gen_rtx_MEM (Pmode, operands[3]);
diff -uprN ORIG/trunk/gcc/testsuite/gcc.dg/pr49307.c 
trunk/gcc/testsuite/gcc.dg/pr49307.c
--- ORIG/trunk/gcc/testsuite/gcc.dg/pr49307.c   1970-01-01 09:00:00.0 
+0900
+++ trunk/gcc/testsuite/gcc.dg/pr49307.c2011-06-09 08:37:41.0 
+0900
@@ -0,0 +1,21 @@
+/* PR target/49307 */
+/* { dg-do compile } */
+/* { dg-options "-O -fpic -fstack-protector" } */
+/* { dg-require-effective-target fpic } */
+/* { dg-require-effective-target fstack_protector } */
+
+extern void bar (char **pp, void *vp);
+extern void free (void *p);
+
+int
+foo (void)
+{
+  char *p;
+  char fext[128];
+
+  p = fext;
+  bar (&p, (void *)0);
+  if (p)
+free (p);
+  return 0;
+}


Re: -fdump-passes -fenable-xxx=func_name_list

2011-06-09 Thread Xinliang David Li
Though I can not reproduce it, it might be related to what Richard
mentioned in the review -- The TODO's are executed though the pass is
not. This opened up a can of worm -- I will revert the patches for
now.

David


On Thu, Jun 9, 2011 at 3:05 PM, H.J. Lu  wrote:
> On Tue, Jun 7, 2011 at 11:54 AM, Xinliang David Li  wrote:
>> Please review the attached two patches.
>>
>> In the first patch, gate functions are cleaned up. All the per
>> function legality checks are moved into the executor and the
>> optimization heuristic checks (optimize for size) remain in the
>> gators. These allow the the following overriding order:
>>
>>    common flags (O2, -ftree-vrp, -fgcse etc)   <---  compiler
>> heuristic (optimize for size/speed) <--- -fdisable/enable forcing pass
>> options  <--- legality check
>>
>> Testing under going. Ok for trunk?
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49350
>
> --
> H.J.
>


Go patch committed: Use backend interface for zero initialization

2011-06-09 Thread Ian Lance Taylor
This patch to the Go frontend uses the backend interface for zero
initialization.  This basically removes quite a bit of unnecessary code,
which was more flexible than it ever really needed to be.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian


2011-06-09  Ian Lance Taylor  

* go-gcc.cc (Gcc_backend::zero_expression): New function.


Index: gcc/go/go-gcc.cc
===
--- gcc/go/go-gcc.cc	(revision 174810)
+++ gcc/go/go-gcc.cc	(working copy)
@@ -194,6 +194,11 @@ class Gcc_backend : public Backend
   bool
   is_circular_pointer_type(Btype*);
 
+  // Expressions.
+
+  Bexpression*
+  zero_expression(Btype*);
+
   // Statements.
 
   Bstatement*
@@ -700,6 +705,20 @@ Gcc_backend::is_circular_pointer_type(Bt
   return btype->get_tree() == ptr_type_node;
 }
 
+// Return the zero value for a type.
+
+Bexpression*
+Gcc_backend::zero_expression(Btype* btype)
+{
+  tree t = btype->get_tree();
+  tree ret;
+  if (t == error_mark_node)
+ret = error_mark_node;
+  else
+ret = build_zero_cst(t);
+  return tree_to_expr(ret);
+}
+
 // An expression as a statement.
 
 Bstatement*
Index: gcc/go/gofrontend/gogo.cc
===
--- gcc/go/gofrontend/gogo.cc	(revision 174810)
+++ gcc/go/gofrontend/gogo.cc	(working copy)
@@ -1498,6 +1498,10 @@ Check_types_traverse::variable(Named_obj
   if (named_object->is_variable())
 {
   Variable* var = named_object->var_value();
+
+  // Give error if variable type is not defined.
+  var->type()->base();
+
   Expression* init = var->init();
   std::string reason;
   if (init != NULL
Index: gcc/go/gofrontend/types.h
===
--- gcc/go/gofrontend/types.h	(revision 174810)
+++ gcc/go/gofrontend/types.h	(working copy)
@@ -825,19 +825,6 @@ class Type
   Btype*
   get_backend(Gogo*);
 
-  // Return a tree representing a zero initialization for this type.
-  // This will be something like an INTEGER_CST or a CONSTRUCTOR.  If
-  // IS_CLEAR is true, then the memory is known to be zeroed; in that
-  // case, this will return NULL if there is nothing to be done.
-  tree
-  get_init_tree(Gogo*, bool is_clear);
-
-  // Like get_init_tree, but passing in the type to use for the
-  // initializer.
-  tree
-  get_typed_init_tree(Gogo* gogo, tree type_tree, bool is_clear)
-  { return this->do_get_init_tree(gogo, type_tree, is_clear); }
-
   // Return a tree for a make expression applied to this type.
   tree
   make_expression_tree(Translate_context* context, Expression_list* args,
@@ -896,9 +883,6 @@ class Type
   do_get_backend(Gogo*) = 0;
 
   virtual tree
-  do_get_init_tree(Gogo*, tree, bool) = 0;
-
-  virtual tree
   do_make_expression_tree(Translate_context*, Expression_list*,
 			  source_location);
 
@@ -1334,9 +1318,6 @@ class Integer_type : public Type
   Btype*
   do_get_backend(Gogo*);
 
-  tree
-  do_get_init_tree(Gogo*, tree, bool);
-
   Expression*
   do_type_descriptor(Gogo*, Named_type*);
 
@@ -1406,9 +1387,6 @@ class Float_type : public Type
   Btype*
   do_get_backend(Gogo*);
 
-  tree
-  do_get_init_tree(Gogo*, tree, bool);
-
   Expression*
   do_type_descriptor(Gogo*, Named_type*);
 
@@ -1474,9 +1452,6 @@ class Complex_type : public Type
   Btype*
   do_get_backend(Gogo*);
 
-  tree
-  do_get_init_tree(Gogo*, tree, bool);
-
   Expression*
   do_type_descriptor(Gogo*, Named_type*);
 
@@ -1530,9 +1505,6 @@ class String_type : public Type
   Btype*
   do_get_backend(Gogo*);
 
-  tree
-  do_get_init_tree(Gogo* gogo, tree, bool);
-
   Expression*
   do_type_descriptor(Gogo*, Named_type*);
 
@@ -1650,9 +1622,6 @@ class Function_type : public Type
   Btype*
   do_get_backend(Gogo*);
 
-  tree
-  do_get_init_tree(Gogo*, tree, bool);
-
   Expression*
   do_type_descriptor(Gogo*, Named_type*);
 
@@ -1734,9 +1703,6 @@ class Pointer_type : public Type
   Btype*
   do_get_backend(Gogo*);
 
-  tree
-  do_get_init_tree(Gogo*, tree, bool);
-
   Expression*
   do_type_descriptor(Gogo*, Named_type*);
 
@@ -1988,9 +1954,6 @@ class Struct_type : public Type
   Btype*
   do_get_backend(Gogo*);
 
-  tree
-  do_get_init_tree(Gogo*, tree, bool);
-
   Expression*
   do_type_descriptor(Gogo*, Named_type*);
 
@@ -2106,9 +2069,6 @@ class Array_type : public Type
   do_get_backend(Gogo*);
 
   tree
-  do_get_init_tree(Gogo*, tree, bool);
-
-  tree
   do_make_expression_tree(Translate_context*, Expression_list*,
 			  source_location);
 
@@ -2197,9 +2157,6 @@ class Map_type : public Type
   do_get_backend(Gogo*);
 
   tree
-  do_get_init_tree(Gogo*, tree, bool);
-
-  tree
   do_make_expression_tree(Translate_context*, Expression_list*,
 			  source_location);
 
@@ -2281,9 +2238,6 @@ class Channel_type : public Type
   do_get_backend(Gogo*);
 
   tree
-  do_get_init_tree(Gogo*, tree, bool);
-
-  tree
   do_make_expression_tree(Translate_context*, Expression

Re: -fdump-passes -fenable-xxx=func_name_list

2011-06-09 Thread Xinliang David Li
Patch is temporally rolled back.

Richard, looks like deeper pass manager cleanup is needed -- I would
like to delay that. For now, this leaves us two choices -- 1) do cfunc
push/pop, or 2) do pass dump while executing. None of them is ideal,
but safe enough.

Thanks,

David

On Thu, Jun 9, 2011 at 3:32 PM, Xinliang David Li  wrote:
> Though I can not reproduce it, it might be related to what Richard
> mentioned in the review -- The TODO's are executed though the pass is
> not. This opened up a can of worm -- I will revert the patches for
> now.
>
> David
>
>
> On Thu, Jun 9, 2011 at 3:05 PM, H.J. Lu  wrote:
>> On Tue, Jun 7, 2011 at 11:54 AM, Xinliang David Li  
>> wrote:
>>> Please review the attached two patches.
>>>
>>> In the first patch, gate functions are cleaned up. All the per
>>> function legality checks are moved into the executor and the
>>> optimization heuristic checks (optimize for size) remain in the
>>> gators. These allow the the following overriding order:
>>>
>>>    common flags (O2, -ftree-vrp, -fgcse etc)   <---  compiler
>>> heuristic (optimize for size/speed) <--- -fdisable/enable forcing pass
>>> options  <--- legality check
>>>
>>> Testing under going. Ok for trunk?
>>>
>>
>> This caused:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49350
>>
>> --
>> H.J.
>>
>


Re: [PATCH] [Bug c++/49118] fake template nesting for operator-> chain

2011-06-09 Thread David Krauss
On Jun 6, 2011, at 1:28 PM, Jason Merrill wrote:

> On 06/02/2011 03:25 PM, David Krauss wrote:
>> Optimally the re-opened context would be the preceding operator->  function 
>> itself, to create the illusion of nested calls. However, the result of 
>> build_new_op may be a target_expr or a call_expr. I'm not sure of the best 
>> way to recover the function declaration from this ambiguous tree, nor 
>> whether it would a performance issue (i.e., too much work for the reward).
> 
> For a CALL_EXPR you can use get_callee_fndecl.  I wouldn't object to teaching 
> it to handle TARGET_EXPR and AGGR_INIT_EXPR as well.

I had played around with this a bit in the meantime. It still gets stumped if 
operator-> is virtual. I don't know how to recover a virtual fn declaration 
from the tree of a virtual dispatch, but it seems to require recovery of and 
indirection through the vtable.

A completely different alternative is to change the overloaded_p argument of 
build_new_op from a bool* to a tree*. Instead of returning *whether* an 
overload was used, it should return *which* was used if any. This seems to be 
much lower impact and returns some side benefit. Perhaps the argument should be 
changed to a z_candidate** instead?

Patch attached. 90% of it is just stripping the "_p" from the name of the 
variable which is no longer a predicate. The change propagates to a few other 
functions, but the changes are mostly unsubstantial. I did eliminate one dead 
variable in cp_parser_omp_for_cond.

> As for the duplicate error message, that happens because we complain when 
> doing push_tinst_level first in instantiate_decl and then again in 
> build_x_arrow.  To avoid this we would need to hit each new depth first in 
> build_x_arrow, either by pushing and then popping again before the call the 
> build_new_op, or adding something like suspend/resume_tinst_level to pt.c.

The complaints happen inside build_new_op, not from my added push_tinst_level. 
Looks like I'm creating a novel condition where the return type has not been 
instantiated before it is used in the function call. One message results from 
the function body and another results from the function return type. Perhaps 
the multiple messages should be regarded as a separate low-priority bug. A 
reference return type results in three messages, all from the class template, 
for what it's worth.

This passes check-g++ applied to recent trunk code.

- D
 


endless_arrow.clog
Description: Binary data



endless_arrow.patch
Description: Binary data




Cgraph alias reorg 1/14

2011-06-09 Thread Jan Hubicka
Hi,
there is bug in record_eh_tables that fires in one of C++ testcases where
personality function is present in the same unit and GCC happily optimizes it
out because it fails to set address_taken flag.

Bootstrapped/regtested x86_64-linux, will commit it shortly.

* cgraphbuild.c (record_eh_tables): Mark personality function as having
address taken.
Index: cgraphbuild.c
===
--- cgraphbuild.c   (revision 174804)
+++ cgraphbuild.c   (working copy)
@@ -149,9 +149,13 @@ record_eh_tables (struct cgraph_node *no
   eh_region i;
 
   if (DECL_FUNCTION_PERSONALITY (node->decl))
-ipa_record_reference (node, NULL,
-  cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->decl)),
-  NULL, IPA_REF_ADDR, NULL);
+{
+  struct cgraph_node *per_node;
+
+  per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY 
(node->decl));
+  ipa_record_reference (node, NULL, per_node, NULL, IPA_REF_ADDR, NULL);
+  cgraph_mark_address_taken_node (per_node);
+}
 
   i = fun->eh->region_tree;
   if (!i)


Re: [testsuite] skip ARM neon-fp16 tests for other -mcpu values

2011-06-09 Thread Janis Johnson
On 06/08/2011 03:17 AM, Joseph S. Myers wrote:
> On Tue, 7 Jun 2011, Janis Johnson wrote:
> 
>> These tests fail when multilib options use -mfpu= and override the
>> -mfpu=neon-fp16 used for the test:
>>
>>   g++.dg/ext/arm-fp16/arm-fp16-ops-5.C
>>   g++.dg/ext/arm-fp16/arm-fp16-ops-6.C
>>   gcc.dg/torture/arm-fp16-ops-5.c
>>   gcc.dg/torture/arm-fp16-ops-6.c
>>   gcc.target/arm/fp16-compile-vcvt.c
>>
>> The option -mfpu-neon-fp16 is added via "dg-add-options arm_neon_fp16"
>> after an earlier "dg-require-effective-target arm_neon_fp16_ok".
>> This patch modifies check_effective_target_arm_neon_fp16_ok_nocache to
>> return 0 (causing the test to be skipped) if multilib flags include
>> -mfpu= with a value other than neon-fp16.
> 
> But I'd think they ought to work with any -mfpu= option supporting 
> half-precision instructions - that is, vfpv3-fp16, vfpv3-d16-fp16, 
> vfpv3xd-fp16, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16, neon-vfpv4 
> (anything with "true" in the last field in arm-fpus.def; for the 
> testsuite, you can probably suppose anything -mfpu=*fp16*, 
> -mfpu=*fpv[4-9]*, -mfpu=*fpv[1-9][0-9]*).
> 

These tests look for specific instructions being generated and fail when
the check is hacked up to allow other fp16 variants and not require neon.
I'd like to use the original patch for this.  OK?

Janis


Re: [google] pessimize stack accounting during inlining

2011-06-09 Thread Mark Heffernan
On Wed, Jun 8, 2011 at 1:54 AM, Richard Guenther
 wrote:
> Well, it's still not a hard limit as we can't tell how many spill slots
> or extra call argument or return value slots we need.

Agreed.  It's not perfect.  But I've found this does a reasonable job
of preventing the inliner from pushing the frame size much beyond the
imposed limit especially if the limit is large (eg, many K) relative
to the typical total size of spill slots, arguments, etc.

Mark

>
> Richard.
>
> > Thanks,
> >
> > David
> >
> > On Tue, Jun 7, 2011 at 4:29 PM, Mark Heffernan  wrote:
> >> This patch pessimizes stack accounting during inlining.  This enables
> >> setting a firm stack size limit (via parameters "large-stack-frame" and
> >> "large-stack-frame-growth").  Without this patch the inliner is overly
> >> optimistic about potential stack reuse resulting in actual stack frames 
> >> much
> >> larger than the parameterized limits.
> >> Internal benchmarks show minor performance differences with non-fdo and
> >> lipo, but overall neutral.  Tested/bootstrapped on x86-64.
> >> Ok for google-main?
> >> Mark
> >>
> >> 2011-06-07  Mark Heffernan  
> >>         * cgraph.h (cgraph_global_info): Remove field.
> >>         * ipa-inline.c (cgraph_clone_inlined_nodes): Change
> >>         stack frame computation.
> >>         (cgraph_check_inline_limits): Ditto.
> >>         (compute_inline_parameters): Remove dead initialization.
> >>
> >> Index: gcc/cgraph.h
> >> ===
> >> --- gcc/cgraph.h        (revision 174512)
> >> +++ gcc/cgraph.h        (working copy)
> >> @@ -136,8 +136,6 @@ struct GTY(()) cgraph_local_info {
> >>  struct GTY(()) cgraph_global_info {
> >>    /* Estimated stack frame consumption by the function.  */
> >>    HOST_WIDE_INT estimated_stack_size;
> >> -  /* Expected offset of the stack frame of inlined function.  */
> >> -  HOST_WIDE_INT stack_frame_offset;
> >>
> >>    /* For inline clones this points to the function they will be
> >>       inlined into.  */
> >> Index: gcc/ipa-inline.c
> >> ===
> >> --- gcc/ipa-inline.c    (revision 174512)
> >> +++ gcc/ipa-inline.c    (working copy)
> >> @@ -229,8 +229,6 @@ void
> >>  cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
> >>                             bool update_original)
> >>  {
> >> -  HOST_WIDE_INT peak;
> >> -
> >>    if (duplicate)
> >>      {
> >>        /* We may eliminate the need for out-of-line copy to be output.
> >> @@ -279,13 +277,13 @@ cgraph_clone_inlined_nodes (struct cgrap
> >>      e->callee->global.inlined_to = e->caller->global.inlined_to;
> >>    else
> >>      e->callee->global.inlined_to = e->caller;
> >> -  e->callee->global.stack_frame_offset
> >> -    = e->caller->global.stack_frame_offset
> >> -      + inline_summary (e->caller)->estimated_self_stack_size;
> >> -  peak = e->callee->global.stack_frame_offset
> >> -      + inline_summary (e->callee)->estimated_self_stack_size;
> >> -  if (e->callee->global.inlined_to->global.estimated_stack_size < peak)
> >> -    e->callee->global.inlined_to->global.estimated_stack_size = peak;
> >> +
> >> +  /* Pessimistically assume no sharing of stack space.  That is, the
> >> +     frame size of a function is estimated as the original frame size
> >> +     plus the sum of the frame sizes of all inlined callees.  */
> >> +  e->callee->global.inlined_to->global.estimated_stack_size +=
> >> +    inline_summary (e->callee)->estimated_self_stack_size;
> >> +
> >>    cgraph_propagate_frequency (e->callee);
> >>
> >>    /* Recursively clone all bodies.  */
> >> @@ -430,8 +428,7 @@ cgraph_check_inline_limits (struct cgrap
> >>
> >>    stack_size_limit += stack_size_limit * PARAM_VALUE
> >> (PARAM_STACK_FRAME_GROWTH) / 100;
> >>
> >> -  inlined_stack = (to->global.stack_frame_offset
> >> -                  + inline_summary (to)->estimated_self_stack_size
> >> +  inlined_stack = (to->global.estimated_stack_size
> >>                    + what->global.estimated_stack_size);
> >>    if (inlined_stack  > stack_size_limit
> >>        && inlined_stack > PARAM_VALUE (PARAM_LARGE_STACK_FRAME))
> >> @@ -2064,7 +2061,6 @@ compute_inline_parameters (struct cgraph
> >>    self_stack_size = optimize ? estimated_stack_frame_size (node) : 0;
> >>    inline_summary (node)->estimated_self_stack_size = self_stack_size;
> >>    node->global.estimated_stack_size = self_stack_size;
> >> -  node->global.stack_frame_offset = 0;
> >>
> >>    /* Can this function be inlined at all?  */
> >>    node->local.inlinable = tree_inlinable_function_p (node->decl);
> >>
> >


Re: [testsuite] skip ARM tests with conflicting options

2011-06-09 Thread Janis Johnson
On 06/08/2011 03:39 AM, Richard Earnshaw wrote:
> On 08/06/11 03:14, Janis Johnson wrote:
>> On 06/07/2011 06:25 PM, Mike Stump wrote:
>>> On Jun 7, 2011, at 4:24 PM, Janis Johnson wrote:
 On 06/07/2011 02:07 PM, Joseph S. Myers wrote:
> On Tue, 7 Jun 2011, Janis Johnson wrote:
>
>> Several tests in gcc.target/arm use dg-options with -mcpu=, which
>> causes compiler warnings or errors when the multilib flags include
>> -march=.  This patch causes those tests to be skipped.  It also
>> prevents gcc.target/arm/20090811-1.c from running with multilibs that
>> would override -mcpu or -mfloat-abi options specified for the test.
>
> I think you should allow compatible -march options - for example, if 
> dg-options has -mcpu=cortex-a8, allow -march=armv7-a but disallow all 
> other -march options.
>
 Is this one OK?
>>>
>>> Not sure if the arm people want to review this or would rather I review 
>>> it...
>>>
>>> Let's give the arm folks a couple days to comment, if no objections, Ok.
>>>
>>> A point of warning, eventually, you'll discover that when a compiler 
>>> defaults to the argument you want to skip, that you'll needs slightly more 
>>> power to skip them.  darwin ran into this with things like -m64, and 
>>> eventually had to do something like lp64.  configure options like 
>>> --with-cpu=arm9 are the sort that can change the default.
>>
>> Yes, I hope to hear from ARM people.
>>
>> On ARM, the default from --with-cpu= is overridden by -march at
>> compile so it's not a problem for this particular set of tests.
>> As I said originally, this set is the tip of the iceberg and they
>> get more difficult.
>>
>> Janis
>>
>>
> 
> 
> I'm worried by this whole approach of command-line checking.  It works,
> just about, for testsuite variations set with target_list, but it won't
> work with options used to configure the compiler (eg --with-mode=thumb,
> or --with-cpu=...).  Perhaps a better approach would be a new dg- test
> that built a trivial file with all the options and disabled the test if
> that test failed for any reason.  Something like:
> 
> dg-target-compatible (target, , additional-opts)
> 
> The test is only performed if target matches the current target.
> 
> I'm not sure if this is something that can be easily cached (well, it
> might be possible if you could index off additional-opts and the default
> opts), so it might be that this test has to be re-run every time there
> is a test that needs it.
> 
> R.

As I said earlier, the testsuite already provides effective-target support
that checks for complicated things and it's easy enough to add more.

Given that there are lots of spurious failures right now due to tests
being compiled with conflicting options, or during dg-final checks when the
expected code isn't being generated because multilib options override the
ones given in the test, is this patch to skip tests using -mcpu if the
multilibs use -march OK?  I have made the change Joseph suggested to allow
-march values that do not conflict.

Expect lots more of these patches, with perhaps different solutions for
different tests.

Janis



CRIS regclass update, fixing build breakage

2011-06-09 Thread Hans-Peter Nilsson
Updating register classes so that the narrowest class for the
SRP register is now a singleton class, instead of having other
register members without means to move to/from SRP cheaper than
memory, matching the documentation update.  Also fixing the
buglet of not fixing the condition-code-register, ehm.  (Not
that there could be moves for anything but CCmode to or from it,
which is useless anyway for a CC0 port.)  All-in-all, together
with the ira-costs.c patch just committed, unbreaking build for
cris-elf with results at patched r174780 similar to those of
r174114 before the breakage, just adding a libstdc++ SEGV for
20_util/is_nothrow_copy_assignable/value.cc; a regression which
seems unrelated anyway -save-temps makes it go away.  Committed.

PR rtl-optimization/49154
* config/cris/cris.h (FIXED_REGISTERS): Include CRIS_CC0_REGNUM.
(enum reg_class): Add SRP_REGS and MOF_SRP_REGS.
(REG_CLASS_NAMES, REG_CLASS_CONTENTS, REGNO_REG_CLASS)
(PREFERRED_RELOAD_CLASS, SECONDARY_RELOAD_CLASS): Adjust to fit.
* config/cris/cris.h (cris_register_move_cost): Remove
!TARGET_V32 code.  Tweak comments.

diff --git gcc/config/cris/cris.c gcc/config/cris/cris.c
index 110e985..159b31b 100644
--- gcc/config/cris/cris.c
+++ gcc/config/cris/cris.c
@@ -1360,24 +1360,11 @@ static int
 cris_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
 reg_class_t from, reg_class_t to)
 {
-  if (!TARGET_V32)
-{
-  /* Pretend that classes that we don't support are ALL_REGS, so
-we give them the highest cost.  */
-  if (from != SPECIAL_REGS && from != MOF_REGS
- && from != GENERAL_REGS && from != GENNONACR_REGS)
-   from = ALL_REGS;
-
-  if (to != SPECIAL_REGS && to != MOF_REGS
- && to != GENERAL_REGS && to != GENNONACR_REGS)
-   to = ALL_REGS;
-}
-
   /* Can't move to and from a SPECIAL_REGS register, so we have to say
  their move cost within that class is higher.  How about 7?  That's 3
  for a move to a GENERAL_REGS register, 3 for the move from the
  GENERAL_REGS register, and 1 for the increased register pressure.
- Also, it's higher than the memory move cost, which is in order.  
+ Also, it's higher than the memory move cost, as it should.
  We also do this for ALL_REGS, since we don't want that class to be
  preferred (even to memory) at all where GENERAL_REGS doesn't fit.
  Whenever it's about to be used, it's for SPECIAL_REGS.  If we don't
@@ -1386,13 +1373,15 @@ cris_register_move_cost (enum machine_mode mode 
ATTRIBUTE_UNUSED,
  GENERAL_REGS left to allocate.  This is because the fall-back when
  the most preferred register class isn't available, isn't the next
  (or next good) wider register class, but the *most widest* register
- class.  */
+ class.  FIXME: pre-IRA comment, perhaps obsolete now.  */
 
   if ((reg_classes_intersect_p (from, SPECIAL_REGS)
&& reg_classes_intersect_p (to, SPECIAL_REGS))
   || from == ALL_REGS || to == ALL_REGS)
 return 7;
 
+  /* Make moves to/from SPECIAL_REGS slightly more expensive, as we
+ generally prefer GENERAL_REGS.  */
   if (reg_classes_intersect_p (from, SPECIAL_REGS)
   || reg_classes_intersect_p (to, SPECIAL_REGS))
 return 3;
diff --git gcc/config/cris/cris.h gcc/config/cris/cris.h
index 57bdd46..872165e 100644
--- gcc/config/cris/cris.h
+++ gcc/config/cris/cris.h
@@ -418,7 +418,7 @@ extern int cris_cpu_version;
registers are fixed at the moment.  The faked argument pointer register
is fixed too.  */
 #define FIXED_REGISTERS \
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0}
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1}
 
 /* Register r9 is used for structure-address, r10-r13 for parameters,
r10- for return values.  */
@@ -488,17 +488,17 @@ extern int cris_cpu_version;
 
 /* Node: Register Classes */
 
-/* FIXME: A separate class for the return register would make sense.
-
-   We need a separate register class to handle register allocation for
+/* We need a separate register class to handle register allocation for
ACR, since it can't be used for post-increment.
 
It's not obvious, but having subunions of all movable-between
-   register classes does really help register allocation.  */
+   register classes does really help register allocation (pre-IRA
+   comment).  */
 enum reg_class
   {
 NO_REGS,
-ACR_REGS, MOF_REGS, CC0_REGS, SPECIAL_REGS,
+ACR_REGS, MOF_REGS, SRP_REGS, CC0_REGS,
+MOF_SRP_REGS, SPECIAL_REGS,
 SPEC_ACR_REGS, GENNONACR_REGS,
 SPEC_GENNONACR_REGS, GENERAL_REGS,
 ALL_REGS,
@@ -509,7 +509,8 @@ enum reg_class
 
 #define REG_CLASS_NAMES\
   {"NO_REGS",  \
-   "ACR_REGS", "MOF_REGS", "CC0_REGS", "SPECIAL_REGS", \
+   "ACR_REGS", "MOF_REGS", "SRP_REGS", "CC0_REGS", 

Cgraph alias reorg 2/14 (introduction of alias walkers)

2011-06-09 Thread Jan Hubicka
Hi,
this patch adds the functions to walk aliases and updates cgraph.c 
infrastructure to use it.
It also fixes the existing missed optimization where ipa-pure-const and friends 
did not update
decls of the same body aliases.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

* cgraph.h (cgraph_only_called_directly_or_aliased_p): Rename from ...
(cgraph_only_called_directly_p): ... this one; bring offline.
(resolution_used_from_other_file_p, cgraph_used_from_object_file_p,
varpool_used_from_object_file_p): Drop names from the declaratoin.
(cgraph_for_node_thunks_and_aliases, cgraph_for_node_and_aliases,
collect_callers_of_node): New.
(cgraph_function_node, cgraph_function_or_thunk_node): New functions.
(cgraph_edge_recursive_p): Use cgraph_function_node.
* cgraph.c (cgraph_add_thunk): Check that thunk is not already alias.
(cgraph_node_cannot_be_local_p_1): Break out from ...
(cgraph_node_can_be_local_p): ... here; walk aliases.
(cgraph_for_node_thunks_and_aliases): New function.
(cgraph_for_node_and_aliases): New function.
(cgraph_make_node_local_1): Break out from ...
(cgraph_make_node_local) ... here; use 
cgraph_for_node_thunks_and_aliases.
(cgraph_set_nothrow_flag_1): Break out from ...
(cgraph_set_nothrow_flag) ... here; use 
cgraph_for_node_thunks_and_aliases.
(cgraph_set_const_flag_1): Break out from ...
(cgraph_set_const_flag) ... here; use 
cgraph_for_node_thunks_and_aliases.
(cgraph_set_pure_flag_1): Break out from ...
(cgraph_set_pure_flag) ... here; use cgraph_for_node_thunks_and_aliases.
(cgraph_propagate_frequency_1): Break out from ...
(cgraph_propagate_frequency) ... here; use 
cgraph_for_node_thunks_and_aliases.
(cgraph_used_from_object_file_p): Do not care about aliases.
(cgraph_not_only_called_directly_p_1, cgraph_only_called_directly_p): 
New functions.
(collect_callers_of_node_1, collect_callers_of_node): New functions.

Index: cgraph.h
===
--- cgraph.h(revision 174804)
+++ cgraph.h(working copy)
@@ -512,6 +512,7 @@ struct cgraph_node * cgraph_clone_node (
 void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
 void cgraph_make_edge_direct (struct cgraph_edge *, struct cgraph_node *,
  HOST_WIDE_INT);
+bool cgraph_only_called_directly_p (struct cgraph_node *);
 
 struct cgraph_asm_node *cgraph_add_asm_node (tree);
 
@@ -537,9 +538,18 @@ bool cgraph_will_be_removed_from_program
   (struct cgraph_node *node);
 bool cgraph_can_remove_if_no_direct_calls_and_refs_p
   (struct cgraph_node *node);
-bool resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution 
resolution);
-bool cgraph_used_from_object_file_p (struct cgraph_node *node);
-bool varpool_used_from_object_file_p (struct varpool_node *node);
+bool resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution);
+bool cgraph_used_from_object_file_p (struct cgraph_node *);
+bool varpool_used_from_object_file_p (struct varpool_node *);
+bool cgraph_for_node_thunks_and_aliases (struct cgraph_node *,
+bool (*) (struct cgraph_node *, void 
*),
+void *,
+bool);
+bool cgraph_for_node_and_aliases (struct cgraph_node *,
+ bool (*) (struct cgraph_node *, void *),
+ void *);
+VEC (cgraph_edge_p, heap) * collect_callers_of_node (struct cgraph_node *node);
+
 
 /* In cgraphunit.c  */
 extern FILE *cgraph_dump_file;
@@ -899,12 +909,12 @@ varpool_node_set_nonempty_p (varpool_nod
   return !VEC_empty (varpool_node_ptr, set->nodes);
 }
 
-/* Return true when function NODE is only called directly.
+/* Return true when function NODE is only called directly or it has alias.
i.e. it is not externally visible, address was not taken and
it is not used in any other non-standard way.  */
 
 static inline bool
-cgraph_only_called_directly_p (struct cgraph_node *node)
+cgraph_only_called_directly_or_aliased_p (struct cgraph_node *node)
 {
   gcc_assert (!node->global.inlined_to);
   return (!node->needed && !node->address_taken
@@ -923,7 +933,8 @@ cgraph_can_remove_if_no_direct_calls_p (
   /* Extern inlines can always go, we will use the external definition.  */
   if (DECL_EXTERNAL (node->decl))
 return true;
-  return !node->address_taken && 
cgraph_can_remove_if_no_direct_calls_and_refs_p (node);
+  return (!node->address_taken
+ && cgraph_can_remove_if_no_direct_calls_and_refs_p (node));
 }
 
 /* Return true when function NODE can be removed from callgraph
@@ -954,17 +965,56 @@ varpool_all_refs_explicit_p (struct varp
 /* Constant pool accessor function.  */
 htab_t constant_pool_htab (void);
 
+/* FIXME: 

Re: Fix PR49154-related SEGV in IRA. And ping.

2011-06-09 Thread H.J. Lu
On Wed, Jun 8, 2011 at 7:27 PM, Hans-Peter Nilsson  wrote:
> First, a ping for
> ;
> updated regclass documentation.  Ok?
>
> Second, I updated the CRIS port to fit the proposed
> documentation update (adding a class as the patch you sent, but
> more complete), with regtest results clean for revisions before
> the revision where build started failing.  But, after that
> revision, I get a SEGV; details added to
> .  At first
> I thought I messed up the regclass description but it appears to
> be just an obvious miss, fixed below.  If it isn't, I think
> setup_regno_cost_classes_by_mode should have a comment as to who
> else should set up regno_cost_classes[regno] and that "who else"
> needs to be fixed to do the setup.  Odd that this bug didn't
> trig before or for any of the targets on which you tested.
> Maybe that makes cris-elf qualify for the set of targets you
> test IRA changes on?
>
> By the way, can we do a s/_aclass/_class/ in applicable files,
> for example ira-costs.c?  Someone appears to have done a botched
> word-replace of class to aclass; besides the identifier "class"
> it changed occurrences within identifiers too (at least those
> after a _) so we have e.g. cost_classes_aclass_cache and
> setup_regno_cost_classes_by_aclass vs. cost_classes_mode_cache
> and setup_regno_cost_classes_by_mode.
>
> Tested on cris-elf; together with the mentioned update it
> restores build with results consistent with those before the
> breakage.
>
> Ok to commit?
>
> gcc:
>        PR rtl-optimization/49154
>        * ira-costs.c (setup_regno_cost_classes_by_mode): If there
>        already is a matching slot in the hashtable, assign it to
>        classes_ptr.
>

This caused:

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

-- 
H.J.


Re: Fix PR49154-related SEGV in IRA. And ping.

2011-06-09 Thread Hans-Peter Nilsson
On Thu, 9 Jun 2011, H.J. Lu wrote:
> >        PR rtl-optimization/49154
> >        * ira-costs.c (setup_regno_cost_classes_by_mode): If there
> >        already is a matching slot in the hashtable, assign it to
> >        classes_ptr.
> >
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49354

Fixed.  Cross-builds apparently don't include -Werror, meh.
Tested by observing warning without, no warning with, committed
as obvious.  Thanks for keeping me honest.  I'm just going to
rant a little and say it's weird that we have to cast a "void *"
to another pointer type, but such is C++ or whatever we're
writing now.

PR bootstrap/49354
* ira-costs.c (setup_regno_cost_classes_by_mode): Add missing cast
to last assignment.

Index: ira-costs.c
===
--- ira-costs.c (revision 174868)
+++ ira-costs.c (working copy)
@@ -300,7 +300,7 @@ setup_regno_cost_classes_by_mode (int re
  *slot = classes_ptr;
}
   else
-   classes_ptr = *slot;
+   classes_ptr = (cost_classes_t) *slot;
   cost_classes_mode_cache[mode] = (cost_classes_t) *slot;
 }
   regno_cost_classes[regno] = classes_ptr;

brgds, H-P

Re: [PATCH 0/4] Docs: extend.texi

2011-06-09 Thread Michael Witten
On Thu, Apr 28, 2011 at 01:20, Michael Witten  wrote:

> See the following emails for a few inlined patches
> to /trunk/gcc/doc/extend.texi (revision 172911):
>
>  [1] Docs: extend.texi: Add missing semicolon for consistency
>  [2] Docs: extend.texi: Remove trailing blanks from lines
>  [3] Docs: extend.texi: Rearrange nodes; no text was removed or added
>  [4] Docs: extend.texi: Reword and rearrange attribute node introductions
>
>  trunk/gcc/doc/extend.texi | 5449 
> +++--
>  1 files changed, 2730 insertions(+), 2719 deletions(-)
>
> CHANGELOG
>
> Essentially, I think it would be easiest to squash all of these patches
> together into one revision; here is a ChangeLog entry for such a revision:
>
> 2011-04-27  Michael Witten 
>
>* gcc/doc/extend.texi: Add a `;', remove trailing whitespace,
>and reorganize nodes to group the discussion of attributes more
>logically.
>
> --
> 1.7.4.18.g68fe8

Please commit these patches, starting here:

 http://gcc.gnu.org/ml/gcc-patches/2011-04/msg02175.html
 Message-ID: <378e16b9-5d40-427c-8b4e-00700b2ad30c-mfwit...@gmail.com

Sincerely,
Michael Witten


[pph] Rename pph_output__tree_header to respect naming convention (issue4528135)

2011-06-09 Thread Gabriel Charette
This was probably introduced in sync with my renaming patch. Just noticed and 
fixed it.

There isn't the equivalent pph_input function, is that normal?

Index: pph-streamer.c
===
--- pph-streamer.c  (revision 174853)
+++ pph-streamer.c  (working copy)
@@ -96,7 +96,7 @@
   streamer_hooks.indexable_with_decls_p = pph_indexable_with_decls_p;
   streamer_hooks.unpack_value_fields = pph_unpack_value_fields;
   streamer_hooks.alloc_tree = pph_alloc_tree;
-  streamer_hooks.output_tree_header = pph_output_tree_header;
+  streamer_hooks.output_tree_header = pph_out_tree_header;
   streamer_hooks.has_unique_integer_csts_p = true;
 }
 
Index: pph-streamer-out.c
===
--- pph-streamer-out.c  (revision 174853)
+++ pph-streamer-out.c  (working copy)
@@ -838,7 +838,7 @@
OB.  If EXPR does not need to be handled specially, do nothing.  */
 
 void
-pph_output_tree_header (struct output_block *ob, tree expr)
+pph_out_tree_header (struct output_block *ob, tree expr)
 {
   pph_stream *stream = (pph_stream *) ob->sdata;
 
Index: pph-streamer.h
===
--- pph-streamer.h  (revision 174853)
+++ pph-streamer.h  (working copy)
@@ -142,7 +142,7 @@
 void pph_init_write (pph_stream *);
 void pph_write_tree (struct output_block *, tree, bool ref_p);
 void pph_pack_value_fields (struct bitpack_d *, tree);
-void pph_output_tree_header (struct output_block *, tree);
+void pph_out_tree_header (struct output_block *, tree);
 void pph_out_chain_filtered (pph_stream *, tree, bool, enum chain_filter);
 
 /* In name-lookup.c.  */
Index: ChangeLog.pph
===
--- ChangeLog.pph   (revision 174853)
+++ ChangeLog.pph   (working copy)
@@ -1,3 +1,8 @@
+2011-06-09  Gabriel Charette  
+
+   * pph-streamer-out.c (pph_out_tree_header): Rename from
+ pph_output_tree_header. Update all users.
+
 2011-06-08   Diego Novillo  
 
* parser.c (cp_lexer_dump_tokens): If START_TOKEN is NULL,

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


Re: [pph] Rename pph_output__tree_header to respect naming convention (issue4528135)

2011-06-09 Thread Diego Novillo
On Thu, Jun 9, 2011 at 18:58, Gabriel Charette  wrote:
> This was probably introduced in sync with my renaming patch. Just noticed and 
> fixed it.
>
> There isn't the equivalent pph_input function, is that normal?

Yeah, the bits written by the header output routine are read and used
by the alloc_tree() hook on the reading side.  The tree header is used
by those special trees that need extra information to be materialized
on the reading side.

> Index: pph-streamer.c
> ===
> --- pph-streamer.c      (revision 174853)
> +++ pph-streamer.c      (working copy)
> @@ -96,7 +96,7 @@
>   streamer_hooks.indexable_with_decls_p = pph_indexable_with_decls_p;
>   streamer_hooks.unpack_value_fields = pph_unpack_value_fields;
>   streamer_hooks.alloc_tree = pph_alloc_tree;
> -  streamer_hooks.output_tree_header = pph_output_tree_header;
> +  streamer_hooks.output_tree_header = pph_out_tree_header;
>   streamer_hooks.has_unique_integer_csts_p = true;
>  }
>
> Index: pph-streamer-out.c
> ===
> --- pph-streamer-out.c  (revision 174853)
> +++ pph-streamer-out.c  (working copy)
> @@ -838,7 +838,7 @@
>    OB.  If EXPR does not need to be handled specially, do nothing.  */
>
>  void
> -pph_output_tree_header (struct output_block *ob, tree expr)
> +pph_out_tree_header (struct output_block *ob, tree expr)
>  {
>   pph_stream *stream = (pph_stream *) ob->sdata;
>
> Index: pph-streamer.h
> ===
> --- pph-streamer.h      (revision 174853)
> +++ pph-streamer.h      (working copy)
> @@ -142,7 +142,7 @@
>  void pph_init_write (pph_stream *);
>  void pph_write_tree (struct output_block *, tree, bool ref_p);
>  void pph_pack_value_fields (struct bitpack_d *, tree);
> -void pph_output_tree_header (struct output_block *, tree);
> +void pph_out_tree_header (struct output_block *, tree);
>  void pph_out_chain_filtered (pph_stream *, tree, bool, enum chain_filter);
>
>  /* In name-lookup.c.  */
> Index: ChangeLog.pph
> ===
> --- ChangeLog.pph       (revision 174853)
> +++ ChangeLog.pph       (working copy)
> @@ -1,3 +1,8 @@
> +2011-06-09  Gabriel Charette  
> +
> +       * pph-streamer-out.c (pph_out_tree_header): Rename from
> +         pph_output_tree_header. Update all users.
> +

OK.


Diego.


Re: [pph] Rename pph_output__tree_header to respect naming convention (issue4528135)

2011-06-09 Thread Diego Novillo
On Thu, Jun 9, 2011 at 19:06, Diego Novillo  wrote:

>> +2011-06-09  Gabriel Charette  
>> +
>> +       * pph-streamer-out.c (pph_out_tree_header): Rename from
>> +         pph_output_tree_header. Update all users.
>> +
>
> OK.

Committed at rev. 174879.


Diego.


Re: [PATCH] [Bug c++/49118] fake template nesting for operator-> chain

2011-06-09 Thread Jason Merrill

Looks good, just need ChangeLog and testcase now.

Jason


Re: [PATCH] [Bug c++/49118] fake template nesting for operator-> chain

2011-06-09 Thread David Krauss
On Jun 9, 2011, at 7:54 PM, Jason Merrill wrote:

> Looks good, just need ChangeLog and testcase now.
> 
> Jason

The changelog is the .clog attachment to previous.

I tried the testcase below but dejagnu seemed to hang with no compiler process 
running. I really don't know how to use dg, so perhaps there's an obvious error.

- D

// { dg-do compile }

template< int n >
struct a { 
a< n+1 >
operator->()
{ return a< n+1 >(); }
};

int main() {
a<0>()->x; // { dg-error "instantiation depth exceeds maximum" }
}



Re: FORBIDDEN_INC_DEC_CLASSES in ira-costs.c

2011-06-09 Thread Hans-Peter Nilsson
On Thu, 9 Jun 2011, Vladimir Makarov wrote:
> On 06/08/2011 12:37 PM, Hans-Peter Nilsson wrote:
> > There's a lot of dead code inside the obsolete (removed in 2009)
> > and nowhere else set #ifdef FORBIDDEN_INC_DEC_CLASSES.
> > Remove and poison?
> >
> Yes, I believe so.
> > I'd say borderline obvious, but maybe there's instead reason to
> > reinstate it, if that code is tested and supposed to be live.
> I can not remember a reason to save it.  A big part of ira-costs.c was
> inherited from old reglcasses.c before the macro was removed.  Probably
> therefore it occurred again.
>
> Thanks for finding this.  I'd really appreciate if you submit a patch removing
> this.  I'll try to give it a quick review.

Tested by adding a #define FORBIDDEN_INC_DEC_CLASSES xyzzy to cris.h
and observing (1) without poison, build dies because of references to
undefined forbidden_inc_dec_class (ira-costs.c being the sole "referer")
and (2) with poison, compilation dies at first compilation including
cris.h due to the poisoning, (3) without the #define-dummy but with
poison, compilation dies in ira-costs.c on first reference to
FORBIDDEN_INC_DEC_CLASSES due to the poisoning, so you don't have to
trust me on my word that I managed to remove them all. :)
Thus, except for the comment adjustments and formatting, the removal is
mechanical and self-checking. ...and no warnings this time!

Ok?

* ira-costs.c: Remove #ifdefs on dead FORBIDDEN_INC_DEC_CLASSES.
Adjust comments.
* system.h (FORBIDDEN_INC_DEC_CLASSES): Poison.

Index: system.h
===
--- system.h(revision 174865)
+++ system.h(working copy)
@@ -826,7 +826,8 @@ extern void fancy_abort (const char *, i
FUNCTION_ARG_BOUNDARY MUST_USE_SJLJ_EXCEPTIONS US_SOFTWARE_GOFAST  \
USING_SVR4_H SVR4_ASM_SPEC FUNCTION_ARG FUNCTION_ARG_ADVANCE   \
FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION \
-   MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS
+   MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS\
+   FORBIDDEN_INC_DEC_CLASSES

 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE  \
Index: ira-costs.c
===
--- ira-costs.c (revision 174878)
+++ ira-costs.c (working copy)
@@ -46,15 +46,9 @@ static bool pseudo_classes_defined_p = f
 /* TRUE if we work with allocnos.  Otherwise we work with pseudos.  */
 static bool allocno_p;

-/* Number of elements in arrays `in_inc_dec' and `costs'.  */
+/* Number of elements in array `costs'.  */
 static int cost_elements_num;

-#ifdef FORBIDDEN_INC_DEC_CLASSES
-/* Indexed by n, is TRUE if allocno or pseudo with number N is used in
-   an auto-inc or auto-dec context.  */
-static bool *in_inc_dec;
-#endif
-
 /* The `costs' struct records the cost of using hard registers of each
class considered for the calculation and of using memory for each
allocno or pseudo.  */
@@ -1135,13 +1129,7 @@ record_address_regs (enum machine_mode m
 case PRE_DEC:
   /* Double the importance of an allocno that is incremented or
 decremented, since it would take two extra insns if it ends
-up in the wrong place.  If the operand is a pseudo-register,
-show it is being used in an INC_DEC context.  */
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-  if (REG_P (XEXP (x, 0))
- && REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER)
-   in_inc_dec[COST_INDEX (REGNO (XEXP (x, 0)))] = true;
-#endif
+up in the wrong place.  */
   record_address_regs (mode, XEXP (x, 0), 0, code, SCRATCH, 2 * scale);
   break;

@@ -1380,9 +1368,6 @@ print_allocno_costs (FILE *f)
{
  rclass = cost_classes[k];
  if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]
-#ifdef FORBIDDEN_INC_DEC_CLASSES
- && (! in_inc_dec[i] || ! forbidden_inc_dec_class[rclass])
-#endif
 #ifdef CANNOT_CHANGE_MODE_CLASS
  && ! invalid_mode_change_p (regno, (enum reg_class) rclass)
 #endif
@@ -1425,9 +1410,6 @@ print_pseudo_costs (FILE *f)
{
  rclass = cost_classes[k];
  if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]
-#ifdef FORBIDDEN_INC_DEC_CLASSES
- && (! in_inc_dec[regno] || ! forbidden_inc_dec_class[rclass])
-#endif
 #ifdef CANNOT_CHANGE_MODE_CLASS
  && ! invalid_mode_change_p (regno, (enum reg_class) rclass)
 #endif
@@ -1477,9 +1459,6 @@ find_costs_and_classes (FILE *dump_file)
   enum reg_class *regno_best_class;

   init_recog ();
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-  in_inc_dec = ira_allocate (sizeof (bool) * cost_elements_num);
-#endif /* FORBIDDEN_INC_DEC_CLASSES */
   regno_best_class
 = (enum reg_class *) ira_allocate (max_reg_num ()
   * sizeof (enum reg_class));
@@ -1544,9 +1523,6 @@ find_costs_and_classes (FILE *dump_file)
 

Re: Remove SETJMP_VIA_SAVE_AREA support

2011-06-09 Thread Hans-Peter Nilsson
On Thu, 9 Jun 2011, Eric Botcazou wrote:
> > Poison it (in system.h)?
>
> Let's keep pretending that it never existed. :-)

No can do.  It had been there for too many releases (even one is
one too many), at least 13 years according to the ChangeLogs.
I even went looking for it for PR48542 having a vague
recollection of it.  Committed as obvious.

gcc:
* system.h (SETJMP_VIA_SAVE_AREA): Poison.

Index: system.h
===
--- system.h(revision 174865)
+++ system.h(working copy)
@@ -826,7 +826,8 @@ extern void fancy_abort (const char *, i
FUNCTION_ARG_BOUNDARY MUST_USE_SJLJ_EXCEPTIONS US_SOFTWARE_GOFAST  \
USING_SVR4_H SVR4_ASM_SPEC FUNCTION_ARG FUNCTION_ARG_ADVANCE   \
FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION \
-   MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS
+   MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS\
+   SETJMP_VIA_SAVE_AREA

 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE  \

brgds, H-P


v3 testsuite PATCH to avoid dg-excess-errors

2011-06-09 Thread Jason Merrill
dg-excess-errors is a very large hammer that is rarely what you want to 
use.  To filter out certain messages, it is better to use 
dg-prune-output.  So this patch removes most of the dg-excess-errors 
from the v3 testsuite, replacing some with dg-prune-output, but most 
need no replacement.


Doing this revealed that the bind/ref_neg.cc test was broken; the 
dg-error tags were missing a space before the closing }, so they were 
being ignored.  When I fix that, I find that two of the tests are failing.


I'm committing the first patch, but am holding off on the second for 
now.  Should I go ahead and commit it or would someone like to fix those 
bugs and then commit it themselves?
commit 2ceec8c8f2d4fe83111012361a235dea3c6e5aba
Author: Jason Merrill 
Date:   Thu Jun 9 16:11:22 2011 -0400

	* testsuite/lib/prune.exp (libstdc++-dg-prune): Prune notes.
	* testsuite/20_util/duration/cons/1_neg.cc: Remove dg-excess-errors.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/forward/1_neg.cc: Likewise.
	* testsuite/20_util/function/cmp/cmp_neg.cc: Likewise.
	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.
	* testsuite/20_util/reference_wrapper/ref_neg.cc: Likewise.
	* testsuite/20_util/tuple/comparison_operators/35480_neg.cc: Likewise.
	* testsuite/tr1/6_containers/tuple/comparison_operators/35480_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/unique_ptr_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc: Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr_neg.cc: Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr_rvalue_neg.cc: Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/cons/auto_ptr_neg.cc: Likewise.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise.
	* testsuite/23_containers/map/operators/1_neg.cc: Likewise.
	* testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Likewise.
	* testsuite/decimal/mixed-mode-arith_neg.cc: Likewise.
	* testsuite/decimal/mixed-mode-cmp_neg.cc: Likewise.
	* testsuite/decimal/operator_neg.cc: Likewise.

diff --git a/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc b/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc
index 56b4e4f..eddd57c 100644
--- a/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc
@@ -38,4 +38,3 @@ test02()
   duration d2_copy(d2); // { dg-error "no matching" }
 }
 
-// { dg-excess-errors "candidates are" }
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
index c30d94c..a3ab769 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
@@ -29,9 +29,8 @@ void test01()
   typedef int rep_type;
   typedef int period_type;
   typedef std::chrono::duration test_type;
-  test_type d;
+  test_type d;			// { dg-error "required from here" }
 }
 
 // { dg-error "must be a specialization of ratio" "" { target *-*-* } 227 }
-// { dg-error "required from here" "" { target *-*-* } 32 }
-// { dg-excess-errors "In instantiation of" }
+// { dg-prune-output "not a member" }
diff --git a/libstdc++-v3/testsuite/20_util/forward/1_neg.cc b/libstdc++-v3/testsuite/20_util/forward/1_neg.cc
i

C++ PATCHes to fix issues with running the testsuite in C++0x mode

2011-06-09 Thread Jason Merrill
Periodically I run the G++ testsuite with 
--target_board=unix/-std=gnu++0x to catch any regressions relative to 
C++98 mode.  Here are the fixes from this round:


overflow.patch -- we were forgetting about overflow in some cases, 
causing us to treat an expression as a constant expression when it 
should not be.


build-non.patch -- the call to fold_non_dependent_expr was generating a 
hard error on one testcase, so I've changed it to pass tf_none.


parse-const.patch -- returning error_mark_node in the case of a 
non-constant expression was causing poorer diagnostics in some 
testcases, and returning the expression after complaining doesn't seem 
to break anything.


compound-lit.patch -- some places in the compiler expect a compound 
literal to have TREE_HAS_CONSTRUCTOR set, but we weren't setting it 
anymore.  This patch fixes some ext/ testcases.


cx-testsuite.patch -- various adjustments to either update tests to 
allow C++0x mode output or specify that they are only for C++98 mode.


Tested x86_64-pc-linux-gnu, applying to trunk.
commit e71736621b375d376091a50d17c0cbfb789e2536
Author: Jason Merrill 
Date:   Thu Jun 9 13:59:04 2011 -0400

	* semantics.c (maybe_constant_value): Handle overflowed input.

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index bf6486b..481318e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -6902,7 +6902,8 @@ non_const_var_error (tree r)
   else if (CP_TYPE_VOLATILE_P (type))
 	inform (DECL_SOURCE_LOCATION (r),
 		"%q#D is volatile", r);
-  else if (!DECL_INITIAL (r))
+  else if (!DECL_INITIAL (r)
+	   || !TREE_CONSTANT (DECL_INITIAL (r)))
 	inform (DECL_SOURCE_LOCATION (r),
 		"%qD was not initialized with a constant "
 		"expression", r);
@@ -7337,7 +7338,14 @@ maybe_constant_value (tree t)
   || type_unknown_p (t)
   || !potential_constant_expression (t)
   || value_dependent_expression_p (t))
-return t;
+{
+  if (TREE_OVERFLOW_P (t))
+	{
+	  t = build_nop (TREE_TYPE (t), t);
+	  TREE_CONSTANT (t) = false;
+	}
+  return t;
+}
 
   r = cxx_eval_outermost_constant_expr (t, true);
 #ifdef ENABLE_CHECKING
diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
index 83f5ce1..8aa72f2 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
@@ -51,4 +51,5 @@ test04()
 // { dg-error "required from here" "" { target *-*-* } 46 }
 // { dg-error "denominator cannot be zero" "" { target *-*-* } 268 }
 // { dg-error "out of range" "" { target *-*-* } 269 }
-// { dg-error "overflow in constant expression" "" { target *-*-* } 109 }
+// { dg-error "overflow in constant expression" "" { target *-*-* } 61 }
+// { dg-prune-output "not a member" }
commit fa869080e6f284376c4371644ae9077994eb771b
Author: Jason Merrill 
Date:   Thu Jun 9 13:58:30 2011 -0400

	* pt.c (build_non_dependent_expr): Use fold_non_dependent_expr_sfinae.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 51d590e..ac150ce 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -19124,7 +19124,7 @@ build_non_dependent_expr (tree expr)
   /* Try to get a constant value for all non-type-dependent expressions in
   order to expose bugs in *_dependent_expression_p and constexpr.  */
   if (cxx_dialect >= cxx0x)
-maybe_constant_value (fold_non_dependent_expr (expr));
+maybe_constant_value (fold_non_dependent_expr_sfinae (expr, tf_none));
 #endif
 
   /* Preserve OVERLOADs; the functions must be available to resolve
commit 6fc693c2f5ff6c2ae656bf3e6795b758e223f2cc
Author: Jason Merrill 
Date:   Thu Jun 9 13:58:11 2011 -0400

	* parser.c (cp_parser_constant_expression): Just return the
	non-constant expression.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 1d182a3..35f8957 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7050,8 +7050,6 @@ cp_parser_constant_expression (cp_parser* parser,
 }
   if (allow_non_constant_p)
 *non_constant_p = parser->non_integral_constant_expression_p;
-  else if (parser->non_integral_constant_expression_p)
-expression = error_mark_node;
   parser->non_integral_constant_expression_p
 = saved_non_integral_constant_expression_p;
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C b/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C
index 2094d3e..9942c58 100644
--- a/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C
@@ -7,3 +7,5 @@ foo ()
   const bool b =;		// { dg-error "" }
   foo < b > ();			// { dg-error "constant expression" }
 };
+
+// { dg-error "no match" "" { target *-*-* } 8 }
diff --git a/gcc/testsuite/g++.dg/parse/template7.C b/gcc/testsuite/g++.dg/parse/template7.C
index 0d3f3fa..d7dfef7 100644
--- a/gcc/testsuite/g++.dg/parse/template7.C
+++ b/gcc/testsuite/g++.dg/parse/template7.C
@@ -2,4 +2,3 @@ template 
 void f();			// { dg-

Re: [pph] New script to reproduce failures from a .log file (issue4601050)

2011-06-09 Thread Alexandre Oliva
On Jun  9, 2011, Lawrence Crowl  wrote:

> On 6/9/11, Diego Novillo  wrote:
>> +args="$@"

I'd keep args in "$@" and use "$@" instead of $args, so as to avoid
quoting issues.

>> +line=$(grep "^spawn .*$pattern" $logf | sed -e "s:^spawn ::")

> line=$(sed -e "/^spawn .*$pattern/ ! d ; s/^spawn //" $logf)

> Has one fewer process and one fewer pipe.  Sed is your friend.

I'd have written sed -n "s/^spawn \(.*$pattern\)/\1/p", but I'm not sure
it's more efficient.

It would be wise to first quote slashes in the pattern:

pattern=`echo "$pattern" | sed 's:/:\\/:g'`

>> +if [ "$line" = "" ] ; then

[ -z "$line" ]

Thanks, Diego,

-- 
Alexandre Oliva, freedom fighterhttp://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist  Red Hat Brazil Compiler Engineer


Re: [PATCH] [Bug c++/49118] fake template nesting for operator-> chain

2011-06-09 Thread Jason Merrill

Applied, thanks.

Jason


Re: Remove SETJMP_VIA_SAVE_AREA support

2011-06-09 Thread Eric Botcazou
> No can do.  It had been there for too many releases (even one is
> one too many), at least 13 years according to the ChangeLogs.
> I even went looking for it for PR48542 having a vague
> recollection of it.  Committed as obvious.

OK, thanks.

-- 
Eric Botcazou


Re: [google][RFA] add extra text to stack frame warnings (issue4479046)

2011-06-09 Thread Chris Demetriou
[resending plain text.  Sorry for the noise.]

[sorry, i got stuck doing a bunch of other things.]

On Fri, May 6, 2011 at 10:05, Andrew Pinski  wrote:
>
> On Fri, May 6, 2011 at 1:52 AM, Chris Demetriou  wrote:
> > In theory, a more general warning-text-addition mechanism could be useful.
> > e.g. a flag that said "when outputting a warning about flag 'foo',
> > output this additional text" could be useful.
> > However, we haven't felt the need to do this for other warnings.
> >
> > IMO, a general solution along these lines would be solving a problem
> > that ~nobody has.  8-)
>
> We already output the option which enables the warning that seems like
> a general solution.

Yeah.  I was going to look into using something similar to implement a
generic text-addition mechanism for warnings... but got stuck in
previously-mentioned bunch of other things.  8-(
I ran out of time, ended up checking this in as-is (after updating the
changelog date and retesting).
I may get back to doing it the better way... but it won't be for a while.


chris