[x32] PATCH: Require ia32 instead of ilp32

2011-06-04 Thread H.J. Lu
Hi,

I checked in this patch.

H.J.
---
commit ec77028f71a04a8e48f1d64497acf821d368daf0
Author: H.J. Lu 
Date:   Mon May 30 17:19:09 2011 -0700

Require ia32 instead of ilp32.

diff --git a/gcc/testsuite/ChangeLog.x32 b/gcc/testsuite/ChangeLog.x32
index f82e95c..43af9dd 100644
--- a/gcc/testsuite/ChangeLog.x32
+++ b/gcc/testsuite/ChangeLog.x32
@@ -1,3 +1,7 @@
+2011-05-30  H.J. Lu  
+
+   * gcc.target/i386/pr49095.c: Require ia32 instead of ilp32.
+
 2011-05-27  H.J. Lu  
 
* objc.dg/torture/forward-1.m: Require ia32 instead of ilp32.
diff --git a/gcc/testsuite/gcc.target/i386/pr49095.c 
b/gcc/testsuite/gcc.target/i386/pr49095.c
index bc82020..b7d1fb2 100644
--- a/gcc/testsuite/gcc.target/i386/pr49095.c
+++ b/gcc/testsuite/gcc.target/i386/pr49095.c
@@ -1,7 +1,7 @@
 /* PR rtl-optimization/49095 */
 /* { dg-do compile } */
 /* { dg-options "-Os" } */
-/* { dg-options "-Os -mregparm=2" { target ilp32 } } */
+/* { dg-options "-Os -mregparm=2" { target ia32 } } */
 
 void foo (void *);
 


Re: [PATCH, rs6000] Fix REG_CLASS_CONTENTS

2011-06-04 Thread David Edelsohn
On Fri, Jun 3, 2011 at 8:41 AM, Pat Haugen  wrote:

> I should have asked before, ok for 4.6 also after bootstrap/regtest?

Yes.

Thanks, David


Re: libquadmath with older versions of gcc

2011-06-04 Thread Syed Bilal Mehdi

Matlab only shows a warning as:

Warning: You are using gcc version "4.2.4".  The earliest gcc version
supported
 with mex is "4.0.0".  The latest version tested for use with mex is
"4.2.0".
 To download a different version of gcc, visit http://gcc.gnu.org 

Things work fine though. So I am trying to install gcc-4.6 now, but for some
reason I am getting the following error during 'make'

checking for suffix of object files... configure: error: in
`/scratch/local/Bilal/gccSource2/i686-pc-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

Here is /scratch/local/Bilal/gccSource2/i686-pc-linux-gnu/libgcc/config.log:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by GNU C Runtime Library configure 1.0, which was
generated by GNU Autoconf 2.64.  Invocation command line was

  $ /scratch/local/Bilal/gccSource2/libgcc/configure
--cache-file=./config.cache --enable-multilib
--with-gmp=/scratch/local/Bilal/gmp --with-mpfr=/scratch/local/Bilal/mpfr
--with-mpc=/scratch/local/Bilal/mpc
--enable-languages=c,c++,fortran,java,lto,objc
--program-transform-name=s,y,y, --disable-option-checking
--with-target-subdir=i686-pc-linux-gnu --build=i686-pc-linux-gnu
--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --srcdir=../.././libgcc
--disable-intermodule --enable-checking=yes,types --disable-coverage
--enable-languages=c,lto

## - ##
## Platform. ##
## - ##

hostname = dynamis.ae.uiuc.edu
uname -m = i686
uname -r = 2.6.24-28-generic
uname -s = Linux
uname -v = #1 SMP Fri Feb 11 17:36:45 UTC 2011

/usr/bin/uname -p = unknown
/bin/uname -X = unknown

/bin/arch  = unknown
/usr/bin/arch -k   = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo  = unknown
/bin/machine   = unknown
/usr/bin/oslevel   = unknown
/bin/universe  = unknown

PATH: /site/local/pkg/sge/bin/lx24-x86
PATH: /home/mehdi1/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/bin/X11


## --- ##
## Core tests. ##
## --- ##

configure:1742: creating cache ./config.cache
configure:1903: checking for --enable-version-specific-runtime-libs
configure:1916: result: no
configure:1964: checking for a BSD-compatible install
configure:2032: result: /usr/bin/install -c
configure:2048: checking for gawk
configure:2075: result: gawk
configure:2095: checking build system type
configure:2109: result: i686-pc-linux-gnu
configure:2129: checking host system type
configure:2142: result: i686-pc-linux-gnu
configure:2245: checking for i686-pc-linux-gnu-ar
configure:2272: result: ar
configure:2337: checking for i686-pc-linux-gnu-lipo
configure:2364: result: lipo
configure:2429: checking for i686-pc-linux-gnu-nm
configure:2456: result:
/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/nm
configure:2521: checking for i686-pc-linux-gnu-ranlib
configure:2548: result: ranlib
configure:2613: checking for i686-pc-linux-gnu-strip
configure:2640: result: strip
configure:2702: checking whether ln -s works
configure:2706: result: yes
configure:2723: checking for i686-pc-linux-gnu-gcc
configure:2750: result:
/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/xgcc
-B/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/
-B/scratch/local/Bilal/gcc/i686-pc-linux-gnu/bin/
-B/scratch/local/Bilal/gcc/i686-pc-linux-gnu/lib/ -isystem
/scratch/local/Bilal/gcc/i686-pc-linux-gnu/include -isystem
/scratch/local/Bilal/gcc/i686-pc-linux-gnu/sys-include   
configure:3019: checking for C compiler version
configure:3028:
/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/xgcc
-B/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/
-B/scratch/local/Bilal/gcc/i686-pc-linux-gnu/bin/
-B/scratch/local/Bilal/gcc/i686-pc-linux-gnu/lib/ -isystem
/scratch/local/Bilal/gcc/i686-pc-linux-gnu/include -isystem
/scratch/local/Bilal/gcc/i686-pc-linux-gnu/sys-include--version >&5
xgcc (GCC) 4.6.0
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3039: $? = 0
configure:3028:
/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/xgcc
-B/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/
-B/scratch/local/Bilal/gcc/i686-pc-linux-gnu/bin/
-B/scratch/local/Bilal/gcc/i686-pc-linux-gnu/lib/ -isystem
/scratch/local/Bilal/gcc/i686-pc-linux-gnu/include -isystem
/scratch/local/Bilal/gcc/i686-pc-linux-gnu/sys-include-v >&5
Reading specs from
/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/specs
COLLECT_GCC=/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/xgcc
COLLECT_LTO_WRAPPER=/scratch/local/Bilal/gccSource2/host-i686-pc-linux-gnu/gcc/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure prefix=/scratch/local/Bilal/

Re: PR 49145: Another (zero_extend (const_int ...)) in combine

2011-06-04 Thread Richard Sandiford
Eric Botcazou  writes:
> SUBREG and ZERO_EXTEND of CONST_INTs are treated somewhat specially in the 
> entire file, see for example do_SUBST.  This isn't the case for other unary 
> operators, presumably because this isn't really necessary here.  So I'm not 
> convinced that such a generalization is really a good thing in this case.

OK.  The version below just adds a special case tomake_compound_operation
instead.  As before, I've restricted the simplification to constants,
so that we don't inadvertently undo the effects of m_c_o itself.

Tested on x86_64-linux-gnu and mips-linux-gnu.  OK for trunk?

Richard


gcc/
PR rtl-optimization/49145
* combine.c (make_compound_operation): Handle ZERO_EXTEND specially.

gcc/testsuite/
PR rtl-optimization/49145
From Ryan Mansfield
* gcc.c-torture/compile/pr49145.c: New test.

Index: gcc/combine.c
===
--- gcc/combine.c   2011-06-01 22:09:09.0 +0100
+++ gcc/combine.c   2011-06-01 22:09:26.0 +0100
@@ -7881,7 +7881,20 @@ make_compound_operation (rtx x, enum rtx
   code = GET_CODE (x);
 }
 
-  /* Now recursively process each operand of this operation.  */
+  /* Now recursively process each operand of this operation.  We need to
+ handle ZERO_EXTEND specially so that we don't lose track of the
+ inner mode.  */
+  if (GET_CODE (x) == ZERO_EXTEND)
+{
+  new_rtx = make_compound_operation (XEXP (x, 0), next_code);
+  tem = simplify_const_unary_operation (ZERO_EXTEND, GET_MODE (x),
+   new_rtx, GET_MODE (XEXP (x, 0)));
+  if (tem)
+   return tem;
+  SUBST (XEXP (x, 0), new_rtx);
+  return x;
+}
+
   fmt = GET_RTX_FORMAT (code);
   for (i = 0; i < GET_RTX_LENGTH (code); i++)
 if (fmt[i] == 'e')
Index: gcc/testsuite/gcc.c-torture/compile/pr49145.c
===
--- /dev/null   2011-06-04 08:47:56.158317425 +0100
+++ gcc/testsuite/gcc.c-torture/compile/pr49145.c   2011-06-01 
22:09:26.0 +0100
@@ -0,0 +1,30 @@
+static int
+func1 (int a, int b)
+{
+  return b ? a : a / b;
+}
+
+static unsigned char
+func2 (unsigned char a, int b)
+{
+  return b ? a : b;
+}
+
+int i;
+
+void
+func3 (const int arg)
+{
+  for (i = 0; i != 10; i = foo ())
+{
+  if (!arg)
+   {
+ int j;
+ for (j = 0; j < 5; j += 1)
+   {
+ int *ptr;
+ *ptr = func2 (func1 (arg, *ptr), foo (arg));
+   }
+   }
+}
+}


[PATCH] fixincludes/Makefile for Interix

2011-06-04 Thread Douglas B Rupp
Here's my proposed patch, along the lines you suggested. top_srcdir 
didn't seem to be set, so I used srcdir instead.


Bootstrapped on x86_64-unknown-linux-gnu



2011-06-04  Douglas B Rupp  

* fixincludes/configure.ac (host_makefile_frag): Use mh-interix.
* fixincludes/configure: Regenerate
* fixincludes/Makefile.in (FIXINC_CPPFLAGS): New flag macro.
(@host_makefile_frag@): New substitution placeholder.
(.c.o): Use FIXINC_CPPFLAGS.

diff -rupN gcc.orig/fixincludes/configure.ac gcc/fixincludes/configure.ac
--- gcc.orig/fixincludes/configure.ac   2011-04-06 17:01:09.0 -0700
+++ gcc/fixincludes/configure.ac2011-06-04 13:18:23.0 -0700
@@ -23,6 +23,20 @@ ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual]
 # Determine the noncanonical target name, for directory use.
 ACX_NONCANONICAL_TARGET
 
+host_makefile_frag=/dev/null
+if test -d ${srcdir}/../config ; then
+case "${host}" in
+  *-interix[[3-9]]*)
+host_makefile_frag="config/mh-interix"
+;;
+esac
+fi
+
+if test $host_makefile_frag != /dev/null; then
+  eval host_makefile_frag=${srcdir}/../$host_makefile_frag
+fi
+AC_SUBST_FILE(host_makefile_frag)
+
 # Specify the local prefix
 local_prefix=
 AC_ARG_WITH(local-prefix,
diff -rupN gcc.orig/fixincludes/Makefile.in gcc/fixincludes/Makefile.in
--- gcc.orig/fixincludes/Makefile.in2011-04-06 17:01:09.0 -0700
+++ gcc/fixincludes/Makefile.in 2011-06-04 00:31:30.0 -0700
@@ -32,6 +32,11 @@ WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANT
 LDFLAGS = @LDFLAGS@
 INCLUDES = -I. -I$(srcdir) -I../include -I$(srcdir)/../include
 FIXINC_CFLAGS = -DHAVE_CONFIG_H $(INCLUDES)
+FIXINC_CPPFLAGS =
+
+ host specific makefile fragments come in here.
+@host_makefile_frag@
+###
 
 # Directory where sources are, from where we are.
 srcdir = @srcdir@
@@ -73,7 +78,7 @@ default : all
 # Now figure out from those variables how to compile and link.
 
 .c.o:
-   $(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CFLAGS) $<
+   $(CC) -c $(CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(FIXINC_CPPFLAGS) 
$(FIXINC_CFLAGS) $<
 
 # The only suffixes we want for implicit rules are .c and .o.
 .SUFFIXES:


Re: [wwwdocs] Buildstat update for 4.6

2011-06-04 Thread Gerald Pfeifer
On Fri, 3 Jun 2011, Tom G. Christensen wrote:
> Latest results for 4.6.x

Thanks, Tom!

Gerald



Re: [lto] Merge streamer hooks from pph branch. (issue4568043)

2011-06-04 Thread Diego Novillo
On Wed, Jun 1, 2011 at 15:19, Richard Guenther  wrote:

> Yes, I see no benefit of using a global function to get access
> to the address of a global variable.

There is the minor benefit of being able to control  access to it, but
I don't have a really convincing reason to give you, so I changed it
to a global.

>> >> +     if (h->indexable_with_decls_p && h->indexable_with_decls_p (expr))
>> >> +       {
>> >> +         output_record_start (ob, LTO_global_decl_ref);
>> >> +         lto_output_var_decl_index (ob->decl_state, ob->main_stream, 
>> >> expr);
>> >
>> > Why hook it this way and not
>> >
>> >             if (h->output_tree_ref
>> >                 && h->output_tree_ref (...))
>> >               break;
>> >             gcc_unreachable ();
>> >
>> > I find the flag vs. function hook stuff somewhat odd.
>>
>> Sure.  It's
>
> ... missing words? ;)

Sorry.  I meant to continue with "It's just that this particular hook
is simpler if it only needs to decide whether the node can be written
as a decl reference.  The code to write the node will be the same
everywhere."  It would lead to duplication and the hooks would need to
know more internal details of the generic streamer (they need to write
the reference in exactly the way that lto_input_tree is expecting).

This is not a flag, actually.  It's a predicate function called on a
node.  If the node passes the predicate, then it is written in the
decl index table.


>> >> @@ -1438,8 +1450,27 @@ lto_output_tree (struct output_block *ob, tree 
>> >> expr, bool ref_p)
>> >>       to be materialized by the reader (to implement TYPE_CACHED_VALUES). 
>> >>  */
>> >>    if (TREE_CODE (expr) == INTEGER_CST)
>> >>      {
>> >> -      lto_output_integer_cst (ob, expr, ref_p);
>> >> -      return;
>> >> +      bool is_special;
>> >> +
>> >> +     /* There are some constants that are special to the streamer
>> >> +     (e.g., void_zero_node, truthvalue_false_node).
>> >> +     These constants cannot be rematerialized with
>> >> +     build_int_cst_wide because they may actually lack a type (like
>> >> +     void_zero_node) and they need to be pointer-identical to trees
>> >> +     materialized by the compiler tables like global_trees or
>> >> +     c_global_trees.
>> >> +
>> >> +     If the streamer told us that it has special constants, they
>> >> +     will be preloaded in the streamer cache.  If we find a match,
>> >> +     then stream the constant as a reference so the reader can
>> >> +     re-materialize it from the cache.  */
>> >> +      is_special = streamer_hooks ()->has_unique_integer_csts_p
>> >> +                && lto_streamer_cache_lookup (ob->writer_cache, expr, 
>> >> NULL);
>> >> +      if (!is_special)
>> >> +     {
>> >> +       lto_output_integer_cst (ob, expr, ref_p);
>> >> +       return;
>> >> +     }
>> >
>> > ???  We should not arrive here for such global trees.  Please do not
>> > merge this part of the patch as part of the hook introducing (keep
>> > patches simple, make them do a single thing ...)
>>
>> Not sure what you are objecting to.  We do execute this for global
>> trees in the C++ FE (as described in the comment).  Are you objecting
>> to never handling unique constants or to merging this handling until
>> the pph bits are in?
>
> Are you not pre-loading those global trees then?

I am, but since the streamer always wanted to stream INTEGER_CSTs
separately, it wasn't getting a chance to check the cache first.

> Yes, I think this isn't the time to merge this piece.

No problem.  I'll keep this part in the branch.

> Ah, I think I get it - we don't stream integer constants as trees.

Right.

> But it's odd that you only handle this
> for integer-csts and not other trees we don't stream as-is (and
> thus do not enter into the cache)

Because constants are the only ones that are handled right before the
cache is consulted.  Every other pre-built tree can be cached
(regardless of whether it's handled by the streamer).

> - I think this should be moved up a level and made generic to handle all 
> trees.  Or we should
> handle integer-csts similar to builtins - always enter them in the cache,

I tried this, but the result was sub-optimal
(http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00563.html)
Putting constants in the cache, caused various failures which I never
fully debugged because I noticed an increase in the object size (I
remember it was noticeable, but not by how much).

I didn't insist too much with this approach, so maybe I could try it again.


> or only handle all pre-loaded nodes that way.

That is what we do.  Pre-loaded nodes always go through the cache.
The problem were pre-loaded constants, since they *never* go through
the cache.

>> >> @@ -2238,6 +2269,8 @@ static void
>> >>  lto_writer_init (void)
>> >>  {
>> >>    lto_streamer_init ();
>> >> +  if (streamer_hooks ()->writer_init)
>> >> +    streamer_hooks ()->writer_init ();
>> >
>> > This hook should always exist.  Why is this called in a context with
>> > lto_*?
>

Make ipa-inline-analysis to not ICE on argument count mismatch

2011-06-04 Thread Jan Hubicka
Hi,
ipa-inline-analysis.c took an assumption that number of parameters of callee
match number of parameters of call stmt or we will not inline at type mismatch.
Our type checking code actually allows callee to have more arguments than 
caller,
thus we need to be more permissive here, too.

Bootstrapped/regtested x86_64-linux, commited.

Honza

PR tree-optimization/48893
PR tree-optimization/49091
PR tree-optimization/49179
* ipa-inline-analysis.c (evaluate_conditions_for_known_args):
Bounds check.

* gfortran.dg/pr49179.f90: New testcase

Index: ipa-inline-analysis.c
===
--- ipa-inline-analysis.c   (revision 174641)
+++ ipa-inline-analysis.c   (working copy)
@@ -555,9 +555,17 @@ evaluate_conditions_for_known_args (stru
 
   for (i = 0; VEC_iterate (condition, info->conds, i, c); i++)
 {
-  tree val = VEC_index (tree, known_vals, c->operand_num);
+  tree val;
   tree res;
 
+  /* We allow call stmt to have fewer arguments than the callee
+function (especially for K&R style programs).  So bound
+check here.  */
+  if (c->operand_num < (int)VEC_length (tree, known_vals))
+val = VEC_index (tree, known_vals, c->operand_num);
+  else
+   val = NULL;
+
   if (!val)
{
  clause |= 1 << (i + predicate_first_dynamic_condition);
Index: testsuite/gfortran.dg/pr49179.f90
===
--- testsuite/gfortran.dg/pr49179.f90   (revision 0)
+++ testsuite/gfortran.dg/pr49179.f90   (revision 0)
@@ -0,0 +1,11 @@
+! { dg-options " -O -findirect-inlining" }
+function more_OK (fcn)
+  character(*) more_OK
+  character (*), external :: fcn
+  more_OK = fcn ()
+end function more_OK
+  character(4) :: answer
+  character(4), external :: is_OK, more_OK
+  answer = more_OK (is_OK)
+contains
+END


[v3] update testsuite allocators to C++0x allocator API

2011-06-04 Thread Jonathan Wakely
2011-06-04  Jonathan Wakely  

* testsuite/util/testsuite_allocator.h (tracker_allocator::construct):
Update to C++0x definition using type to construct as template
parameter.
(tracker_allocator::destroy): Likewise for type to destroy.
(uneq_allocator::construct, uneq_allocator::destroy): Likewise.

I updated the various v3 allocators to use the C++0x API last week,
this does the same for the two test allocators.

Tested x86_64-linux, committed to trunk.
Index: testsuite/util/testsuite_allocator.h
===
--- testsuite/util/testsuite_allocator.h(revision 174624)
+++ testsuite/util/testsuite_allocator.h(working copy)
@@ -138,6 +138,23 @@ namespace __gnu_test
 allocate(size_type n, const void* = 0)
 { return static_cast(counter_type::allocate(n * sizeof(T))); }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+template
+  void
+  construct(U* p, Args&&... args) 
+  {
+   ::new((void *)p) U(std::forward(args)...);
+   counter_type::construct();
+  }
+
+template
+  void
+  destroy(U* p)
+  {
+   p->~U();
+   counter_type::destroy();
+  }
+#else
 void
 construct(pointer p, const T& value)
 {
@@ -145,22 +162,13 @@ namespace __gnu_test
   counter_type::construct();
 }
 
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-  template
-void
-construct(pointer p, Args&&... args) 
-   {
- ::new((void *)p) T(std::forward(args)...);
- counter_type::construct();
-   }
-#endif
-
 void
 destroy(pointer p)
 {
   p->~T();
   counter_type::destroy();
 }
+#endif
 
 void
 deallocate(pointer p, size_type num)
@@ -313,34 +321,35 @@ namespace __gnu_test
   max_size() const throw() 
   { return size_type(-1) / sizeof(Tp); }
   
-  void 
-  construct(pointer p, const Tp& val) 
-  { ::new((void *)p) Tp(val); }
-
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
-  template
+  template
 void
-construct(pointer p, Args&&... args) 
-   { ::new((void *)p) Tp(std::forward(args)...); }
-#endif
+construct(U* p, Args&&... args) 
+   { ::new((void *)p) U(std::forward(args)...); }
 
-  void 
-  destroy(pointer p) { p->~Tp(); }
+  template
+   void 
+   destroy(U* p) { p->~U(); }
 
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
   // Not copy assignable...
   uneq_allocator&
   operator=(const uneq_allocator&) = delete;
-#endif
+#else
+  void 
+  construct(pointer p, const Tp& val) 
+  { ::new((void *)p) Tp(val); }
 
-private:
+  void 
+  destroy(pointer p) { p->~Tp(); }
 
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
+private:
   // Not assignable...
   uneq_allocator&
   operator=(const uneq_allocator&);
 #endif
 
+private:
+
   // ... yet swappable!
   friend inline void
   swap(uneq_allocator& a, uneq_allocator& b)


Re: [PATCH] Fix one part of PR42108

2011-06-04 Thread H.J. Lu
On Sat, Dec 19, 2009 at 10:50 AM, H.J. Lu  wrote:
> On Fri, Dec 18, 2009 at 3:29 PM, Richard Guenther  wrote:
>>
>> This fixes one part of PR42108, the missed discovery of a full
>> redundant load.  The issue is that the SSA SCC value-numberer
>> does not visit loads and stores in a defined order.  The (or rather
>> one) fix is to properly canonicalize the virtual operand SSA names
>> we record in the expression hash tables.  The proper canonical
>> virtual operand is the def of the first dominating may-definition
>> (or a PHI node vdef, but we can as well choose a non-may-definition
>> without loss of precision and generality).
>>
>> The patch possibly slows down SCCVN a bit for examples like
>>
>>   # .MEM_2 = VDEF <.MEM_1(D)>
>>   may-def
>>  
>>   # VUSE <.MEM_120>
>>   ... = X;
>>   # VUSE <.MEM_120>
>>   ... = X;
>>
>> where discovering the redundant load of X needs to canonicalize
>> their VUSE SSA name twice (previously we entered the expression
>> into the hashtable with .MEM_120 so it would be found immediately).
>> Now if we had
>>
>>   # VUSE <.MEM_60>
>>   ... = X;
>>
>> inbetween the may-def and the other loads we previously discovered
>> the full redundancy only if we first visited the load with .MEM_60
>> and only after that the loads with .MEM_120.  But nothing guarantees
>> this - this is the case the patch fixes.  There are about 0.5%
>> more redundant loads discovered in tramp3d with this patch.
>>
>> This is a regression of the alias-improvements branch merge as
>> previously we had different virtual operands and thus in more
>> cases the canonical vuses were automagically chosen.
>>
>> Bootstrapped and tested on x86_64-unknown-linux-gnu.  I have patched
>> one of our SPEC / C++ testers for more testing coverage.
>>
>
> This may have caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42435
>

This also caused:

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


-- 
H.J.


Fix lto-cgraph skip_args ICE

2011-06-04 Thread Jan Hubicka
Hi,
PR48954 demonstrate ICE when skip-args bitmap of a clone is NULL.  Fixed this.

Bootstrapped/regtested x86_64-linux, comitted.
Index: ChangeLog
===
*** ChangeLog   (revision 174641)
--- ChangeLog   (working copy)
***
*** 1,3 
--- 1,8 
+ 2011-06-04  Jan Hubicka  
+ 
+   PR lto/48954
+   * lto-cgraph.c (output_node_opt_summary): Handle NULL skip args bitmaps.
+ 
  2011-06-04  Jakub Jelinek  
  
PR target/49281
Index: testsuite/ChangeLog
===
*** testsuite/ChangeLog (revision 174641)
--- testsuite/ChangeLog (working copy)
***
*** 1,3 
--- 1,8 
+ 2011-06-04  Jan Hubicka  
+ 
+   PR lto/48954
+   * g++.dg/torture/pr48954.C: New testcase.
+ 
  2011-06-04  Jakub Jelinek  
  
PR target/49281
Index: testsuite/g++.dg/torture/pr48954.C
===
*** testsuite/g++.dg/torture/pr48954.C  (revision 0)
--- testsuite/g++.dg/torture/pr48954.C  (revision 0)
***
*** 0 
--- 1,28 
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -flto -fno-early-inlining -fkeep-inline-functions" } */
+ struct A
+ {
+   virtual void foo () = 0;
+ };
+ 
+ struct B : A {};
+ struct C : A {};
+ 
+ struct D: C, B
+ {
+   void foo () {}
+ };
+ 
+ static inline void
+ bar (B *b)
+ {
+   b->foo ();
+ }
+ 
+ int
+ main ()
+ {
+   D d;
+   for (;;)
+ bar (&d);
+ }
Index: lto-cgraph.c
===
*** lto-cgraph.c(revision 174641)
--- lto-cgraph.c(working copy)
*** output_node_opt_summary (struct output_b
*** 1598,1611 
int i;
struct cgraph_edge *e;
  
!   lto_output_uleb128_stream (ob->main_stream,
!bitmap_count_bits (node->clone.args_to_skip));
!   EXECUTE_IF_SET_IN_BITMAP (node->clone.args_to_skip, 0, index, bi)
! lto_output_uleb128_stream (ob->main_stream, index);
!   lto_output_uleb128_stream (ob->main_stream,
!bitmap_count_bits 
(node->clone.combined_args_to_skip));
!   EXECUTE_IF_SET_IN_BITMAP (node->clone.combined_args_to_skip, 0, index, bi)
! lto_output_uleb128_stream (ob->main_stream, index);
lto_output_uleb128_stream (ob->main_stream,
 VEC_length (ipa_replace_map_p, 
node->clone.tree_map));
FOR_EACH_VEC_ELT (ipa_replace_map_p, node->clone.tree_map, i, map)
--- 1598,1621 
int i;
struct cgraph_edge *e;
  
!   if (node->clone.args_to_skip)
! {
!   lto_output_uleb128_stream (ob->main_stream,
!bitmap_count_bits (node->clone.args_to_skip));
!   EXECUTE_IF_SET_IN_BITMAP (node->clone.args_to_skip, 0, index, bi)
!   lto_output_uleb128_stream (ob->main_stream, index);
! }
!   else
! lto_output_uleb128_stream (ob->main_stream, 0);
!   if (node->clone.combined_args_to_skip)
! {
!   lto_output_uleb128_stream (ob->main_stream,
!bitmap_count_bits 
(node->clone.combined_args_to_skip));
!   EXECUTE_IF_SET_IN_BITMAP (node->clone.combined_args_to_skip, 0, index, 
bi)
!   lto_output_uleb128_stream (ob->main_stream, index);
! }
!   else
! lto_output_uleb128_stream (ob->main_stream, 0);
lto_output_uleb128_stream (ob->main_stream,
 VEC_length (ipa_replace_map_p, 
node->clone.tree_map));
FOR_EACH_VEC_ELT (ipa_replace_map_p, node->clone.tree_map, i, map)


Re: [patch] add -Wdelete-non-virtual-dtor

2011-06-04 Thread Jonathan Wakely
On 4 June 2011 16:49, Jason Merrill wrote:
> On 06/04/2011 08:45 AM, Jonathan Wakely wrote:
>>
>> +                 if (CLASSTYPE_PURE_VIRTUALS (type))
>> +                   warning(OPT_Wdelete_non_virtual_dtor,
>> +                           "deleting object of abstract class type %qT"
>> +                           " which has non-virtual destructor"
>> +                           " will cause undefined behaviour", type);
>> +                 else
>> +                   warning(OPT_Wdelete_non_virtual_dtor,
>> +                           "deleting object of polymorphic class type
>> %qT"
>> +                           " which has non-virtual destructor"
>> +                           " may cause undefined behaviour", type);
>
> Space before the (.  And let's use "might" instead of "may".  OK with those
> changes.

Fixed and committed, thanks.


Re: [patch] add test for PR c++/33840

2011-06-04 Thread Jason Merrill

OK.

Jason


Re: [patch] add -Wdelete-non-virtual-dtor

2011-06-04 Thread Jason Merrill

On 06/04/2011 08:45 AM, Jonathan Wakely wrote:

+ if (CLASSTYPE_PURE_VIRTUALS (type))
+   warning(OPT_Wdelete_non_virtual_dtor,
+   "deleting object of abstract class type %qT"
+   " which has non-virtual destructor"
+   " will cause undefined behaviour", type);
+ else
+   warning(OPT_Wdelete_non_virtual_dtor,
+   "deleting object of polymorphic class type %qT"
+   " which has non-virtual destructor"
+   " may cause undefined behaviour", type);


Space before the (.  And let's use "might" instead of "may".  OK with 
those changes.


Jason


Re: [PATCH] Optimize (x * 8) | 5 and (x << 3) ^ 3 to use lea (PR target/48688)

2011-06-04 Thread Jakub Jelinek
On Sat, Jun 04, 2011 at 08:19:57AM -0700, H.J. Lu wrote:
> I don't think this pattern is correct.  See:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49281

Fixed thusly, committed as obvious:

2011-06-04  Jakub Jelinek  

PR target/49281
* config/i386/i386.md (*lea_general_4): Require INTVAL (operands[3])
to be strictly smaller than 1 << shiftcount.

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

--- gcc/config/i386/i386.md.jj  2011-06-01 10:20:02.0 +0200
+++ gcc/config/i386/i386.md 2011-06-04 17:21:02.0 +0200
@@ -6425,7 +6425,7 @@ (define_insn_and_split "*lea_general_4"
 || optimize_function_for_size_p (cfun))
&& ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) - 1 < 3
&& ((unsigned HOST_WIDE_INT) INTVAL (operands[3])
-   <= ((unsigned HOST_WIDE_INT) 1 << INTVAL (operands[2])))"
+   < ((unsigned HOST_WIDE_INT) 1 << INTVAL (operands[2])))"
   "#"
   "&& reload_completed"
   [(const_int 0)]
--- gcc/testsuite/gcc.c-torture/execute/pr49281.c.jj2011-06-04 
17:29:39.0 +0200
+++ gcc/testsuite/gcc.c-torture/execute/pr49281.c   2011-06-04 
17:32:05.0 +0200
@@ -0,0 +1,25 @@
+/* PR target/49281 */
+
+extern void abort (void);
+
+__attribute__((noinline, noclone)) int
+foo (int x)
+{
+  return (x << 2) | 4;
+}
+
+__attribute__((noinline, noclone)) int
+bar (int x)
+{
+  return (x << 2) | 3;
+}
+
+int
+main ()
+{
+  if (foo (43) != 172 || foo (1) != 4 || foo (2) != 12)
+abort ();
+  if (bar (43) != 175 || bar (1) != 7 || bar (2) != 11)
+abort ();
+  return 0;
+}


Jakub


[committed] Fix md_unwind_header file name

2011-06-04 Thread John David Anglin
The header file was renamed when it was moved.  Tested on
hppa-unknown-linux-gnu.

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

2011-06-04  John David Anglin  

* config.host (hppa*-*-linux*): Correct md_unwind_header name.

Index: config.host
===
--- config.host (revision 174624)
+++ config.host (working copy)
@@ -298,7 +298,7 @@
 hppa*64*-*-linux*)
;;
 hppa*-*-linux*)
-   md_unwind_header=pa/pa32-linux.h
+   md_unwind_header=pa/linux-unwind.h
;;
 hppa[12]*-*-hpux10*)
md_unwind_header=pa/hpux-unwind.h


Re: [PATCH] Optimize (x * 8) | 5 and (x << 3) ^ 3 to use lea (PR target/48688)

2011-06-04 Thread H.J. Lu
On Wed, Apr 20, 2011 at 9:09 AM, Jakub Jelinek  wrote:
> Hi!
>
> This splitter allows us to optimize (x {* {2,4,8},<< {1,2,3}}) {|,^} y
> for constant integer y <= {1ULL,3ULL,7ULL} using lea{l,q} (| or ^ in
> that case, when the low bits are known to be all 0, is like plus).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2011-04-20  Jakub Jelinek  
>
>        PR target/48688
>        * config/i386/i386.md (*lea_general_4): New define_insn_and_split.
>
>        * gcc.target/i386/pr48688.c: New test.
>
> --- gcc/config/i386/i386.md.jj  2011-04-19 14:08:55.0 +0200
> +++ gcc/config/i386/i386.md     2011-04-20 14:34:50.0 +0200
> @@ -6646,6 +6646,40 @@ (define_insn_and_split "*lea_general_3_z
>  }
>   [(set_attr "type" "lea")
>    (set_attr "mode" "SI")])
> +
> +(define_insn_and_split "*lea_general_4"
> +  [(set (match_operand:SWI 0 "register_operand" "=r")
> +       (any_or:SWI (ashift:SWI (match_operand:SWI 1 "index_register_operand" 
> "l")
> +                               (match_operand:SWI 2 "const_int_operand" "n"))
> +                   (match_operand 3 "const_int_operand" "n")))]
> +  "(mode == DImode
> +    || mode == SImode
> +    || !TARGET_PARTIAL_REG_STALL
> +    || optimize_function_for_size_p (cfun))
> +   && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) - 1 < 3
> +   && ((unsigned HOST_WIDE_INT) INTVAL (operands[3])
> +       <= ((unsigned HOST_WIDE_INT) 1 << INTVAL (operands[2])))"
> +  "#"
> +  "&& reload_completed"
> +  [(const_int 0)]
> +{
> +  rtx pat;
> +  if (mode != DImode)
> +    operands[0] = gen_lowpart (SImode, operands[0]);
> +  operands[1] = gen_lowpart (Pmode, operands[1]);
> +  operands[2] = GEN_INT (1 << INTVAL (operands[2]));
> +  pat = plus_constant (gen_rtx_MULT (Pmode, operands[1], operands[2]),
> +                      INTVAL (operands[3]));
> +  if (Pmode != SImode && mode != DImode)
> +    pat = gen_rtx_SUBREG (SImode, pat, 0);
> +  emit_insn (gen_rtx_SET (VOIDmode, operands[0], pat));
> +  DONE;
> +}
> +  [(set_attr "type" "lea")
> +   (set (attr "mode")
> +      (if_then_else (eq (symbol_ref "mode == DImode") (const_int 0))
> +       (const_string "SI")
> +       (const_string "DI")))])
>
>  ;; Subtract instructions

I don't think this pattern is correct.  See:

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


H.J.


Fix estimate_size_after_inlining ICE

2011-06-04 Thread Jan Hubicka
Hi,
the problem here is that we propagate predicates inconsistently through
inlining breaking the transitivity that is assumed by the size estimate.

Regtested/bootstrapped x86_64-linux, comitted.

Honza
PR tree-optimize/48929
* gcc.c-torture/compile/pr48929.c: New testcase.
* ipa-inline-analysis.c (remap_edge_predicates): Fix handling
of empty predicate.

Index: testsuite/gcc.c-torture/compile/pr48929.c
===
*** testsuite/gcc.c-torture/compile/pr48929.c   (revision 0)
--- testsuite/gcc.c-torture/compile/pr48929.c   (revision 0)
***
*** 0 
--- 1,32 
+ /*{ dg-options "-O  -findirect-inlining" }*/
+ void bar ();
+ 
+ static void
+ f4 (double di, double d, double *dd)
+ {
+   if (d == 0 && di == 0)
+ *dd = 0;
+   bar ();
+ }
+ 
+ static inline void
+ f3 (int i, double d)
+ {
+   double di = i;
+   double dd;
+   f4 (di, d, &dd);
+ }
+ 
+ static inline void
+ f2 (int i, double d)
+ {
+   if (d < 0)
+ f3 (i, d);
+ }
+ 
+ void
+ f1 ()
+ {
+   f2 (0, 1);
+ }
+ 
Index: ipa-inline-analysis.c
===
*** ipa-inline-analysis.c   (revision 174610)
--- ipa-inline-analysis.c   (working copy)
*** remap_edge_predicates (struct cgraph_nod
*** 1949,1954 
--- 1949,1956 
if (!e->inline_failed)
remap_edge_predicates (e->callee, info, callee_info, operand_map,
   possible_truths, toplev_predicate);
+   else
+   edge_set_predicate (e, toplev_predicate);
  }
for (e = node->indirect_calls; e; e = e->next_callee)
  {
*** remap_edge_predicates (struct cgraph_nod
*** 1969,1974 
--- 1971,1978 
  e->frequency = 0;
}
}
+   else
+   edge_set_predicate (e, toplev_predicate);
  }
  }
  
Index: ipa-prop.c
===


Re: fix latent compare-debug problem in cprop

2011-06-04 Thread Steven Bosscher
On Sat, Jun 4, 2011 at 2:50 PM, Alexandre Oliva  wrote:
> If cprop regards changes to debug insns as “changed”, it will perform
> cfg optimizations and more, even if no non-debug insns were changed,
> causing divergence between -g and -g0 compilations.
>
> This was observed during bootstrap-debug-lib of the SSA coalesce patch,
> building a-strsea.adb with -fcompare-debug.  Because of different CFGs,
> cse2 chose different equivalent pseudos for an insn.  -fcompare-debug
> detected the difference in REG notes, even though the executable code
> turned out to be the same.  We can't count on this luck, though: other
> optimization passes could apply different transformations to the
> different CFGs, producing different executable code, which must never
> happen.
>
> This patch fixes the problem, disregarding changes to debug insns as
> “changed”.  Regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok to
> install?

Looks OK to me, although I can't approve it.

I'm curious, though: What CFG changes or other transformations are
performed without this patch? It could be a sign of a missed
optimization before CPROP. Have you looked at that too?

Ciao!
Steven


Ping^4: Re: Updated^2: RFA: Fix middle-end/46500 (void * encapsulated)

2011-06-04 Thread Joern Rennecke

Quoting Joern Rennecke :

Except or the fortran/java bits (committed), this patch hasn't been  
reviewed for

four weeks:
http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00582.html



Re: [trunk<-vta] Re: [vtab] Permit coalescing of user variables

2011-06-04 Thread Jakub Jelinek
On Sat, Jun 04, 2011 at 09:40:38AM -0300, Alexandre Oliva wrote:

The following changes all look wrong to me, they make the tests totally
useless.  If both f and g are used in real code after the asm volatile, then
the both f and g will likely live in some register or memory.
The whole point of the construct in the tests is that f has at that spot
a reg or mem location, but g isn't present anywhere anymore (as the compiler
doesn't or shouldn't know that asm volatile hasn't changed f), thus it
should represent them as bswap/clz/ctz/rotate.

> --- gcc/testsuite/gcc.dg/guality/bswaptest.c.orig 2011-06-04 
> 09:35:38.954014890 -0300
> +++ gcc/testsuite/gcc.dg/guality/bswaptest.c  2011-06-04 09:35:51.345054255 
> -0300
> @@ -10,7 +10,7 @@ foo (long x)
>long g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 12 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  __attribute__((noclone, noinline)) int
> @@ -20,7 +20,7 @@ bar (int x)
>int g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 22 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  int
> Index: gcc/testsuite/gcc.dg/guality/clztest.c
> ===
> --- gcc/testsuite/gcc.dg/guality/clztest.c.orig   2011-06-04 
> 09:35:39.202015678 -0300
> +++ gcc/testsuite/gcc.dg/guality/clztest.c2011-06-04 09:36:17.710136856 
> -0300
> @@ -10,7 +10,7 @@ foo (long x)
>long g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 12 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  __attribute__((noinline, noclone)) long
> @@ -20,7 +20,7 @@ bar (long x)
>long g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 22 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  int
> Index: gcc/testsuite/gcc.dg/guality/ctztest.c
> ===
> --- gcc/testsuite/gcc.dg/guality/ctztest.c.orig   2011-06-04 
> 09:35:39.463016509 -0300
> +++ gcc/testsuite/gcc.dg/guality/ctztest.c2011-06-04 09:36:33.143184587 
> -0300
> @@ -10,7 +10,7 @@ foo (long x)
>long g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 12 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  __attribute__((noinline, noclone)) long
> @@ -20,7 +20,7 @@ bar (long x)
>long g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 22 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  int
> Index: gcc/testsuite/gcc.dg/guality/rotatetest.c
> ===
> --- gcc/testsuite/gcc.dg/guality/rotatetest.c.orig2011-06-04 
> 09:32:07.155300180 -0300
> +++ gcc/testsuite/gcc.dg/guality/rotatetest.c 2011-06-04 09:34:46.757846376 
> -0300
> @@ -10,7 +10,7 @@ f1 (unsigned long x)
>long g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 12 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  __attribute__((noclone, noinline)) long
> @@ -20,7 +20,7 @@ f2 (unsigned long x, int y)
>long g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 22 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  __attribute__((noclone, noinline)) long
> @@ -30,7 +30,7 @@ f3 (unsigned long x, int y)
>long g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 32 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  __attribute__((noclone, noinline)) unsigned int
> @@ -40,7 +40,7 @@ f4 (unsigned int x)
>unsigned int g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 42 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  __attribute__((noclone, noinline)) unsigned int
> @@ -50,7 +50,7 @@ f5 (unsigned int x, int y)
>unsigned int g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 52 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  __attribute__((noclone, noinline)) unsigned int
> @@ -60,7 +60,7 @@ f6 (unsigned int x, int y)
>unsigned int g = f;
>asm volatile ("" : "+r" (f));
>vv++;  /* { dg-final { gdb-test 62 "g" "f" } } */
> -  return f;
> +  return f - g;
>  }
>  
>  int

Jakub


[patch] add test for PR c++/33840

2011-06-04 Thread Jonathan Wakely
The code in the PR is correctly rejected now, this adds a test to
prevent regressions so the PR can be closed.

2011-06-04  Jonathan Wakely  

PR c++/33840
* g++.dg/diagnostic/bitfld2.C: New.


Tested x86_64-linux, ok for trunk and 4.6?
Index: testsuite/g++.dg/diagnostic/bitfld2.C
===
--- testsuite/g++.dg/diagnostic/bitfld2.C   (revision 0)
+++ testsuite/g++.dg/diagnostic/bitfld2.C   (revision 0)
@@ -0,0 +1,9 @@
+// PR c++/33840
+// { dg-do compile }
+
+template struct A
+{
+  struct {} : 2;   // { dg-error "expected ';' after struct" }
+};
+// { dg-error "ISO C.. forbids declaration" "" { target *-*-* } 6 }
+// { dg-error "ISO C.. prohibits anonymous" "" { target *-*-* } 6 }


fix latent compare-debug problem in cprop

2011-06-04 Thread Alexandre Oliva
If cprop regards changes to debug insns as “changed”, it will perform
cfg optimizations and more, even if no non-debug insns were changed,
causing divergence between -g and -g0 compilations.

This was observed during bootstrap-debug-lib of the SSA coalesce patch,
building a-strsea.adb with -fcompare-debug.  Because of different CFGs,
cse2 chose different equivalent pseudos for an insn.  -fcompare-debug
detected the difference in REG notes, even though the executable code
turned out to be the same.  We can't count on this luck, though: other
optimization passes could apply different transformations to the
different CFGs, producing different executable code, which must never
happen.

This patch fixes the problem, disregarding changes to debug insns as
“changed”.  Regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok to
install?

for  gcc/ChangeLog
from  Alexandre Oliva  

	* cprop.c (local_cprop_pass): Don't set changed for debug insns.

Index: gcc/cprop.c
===
--- gcc/cprop.c.orig	2011-06-04 05:09:24.414816329 -0300
+++ gcc/cprop.c	2011-06-04 05:09:25.954797626 -0300
@@ -1223,7 +1223,8 @@ local_cprop_pass (void)
 		{
 		  if (do_local_cprop (reg_use_table[i], insn))
 			{
-			  changed = true;
+			  if (!DEBUG_INSN_P (insn))
+			changed = true;
 			  break;
 			}
 		}


-- 
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: [wwwdocs] Buildstat update for 4.5

2011-06-04 Thread Gerald Pfeifer
On Fri, 3 Jun 2011, Tom G. Christensen wrote:
> Latest results for 4.5.x

Thank, Tom, this is now online.

Gerald


Re: [patch] add -Wdelete-non-virtual-dtor

2011-06-04 Thread Jonathan Wakely
New patch using CLASSTYPE_PURE_VIRTUALS, thanks for that.

Bootstrapped and tested again on x86_64-linux, no regressions.

ChangeLogs as before, OK for trunk?
Index: c-family/c.opt
===
--- c-family/c.opt  (revision 174624)
+++ c-family/c.opt  (working copy)
@@ -331,6 +331,10 @@ Wdeclaration-after-statement
 C ObjC Var(warn_declaration_after_statement) Warning
 Warn when a declaration is found after a statement
 
+Wdelete-non-virtual-dtor
+C++ ObjC++ Var(warn_delnonvdtor) Warning
+Warn about deleting polymorphic objects with non-virtual destructors
+
 Wdeprecated
 C C++ ObjC ObjC++ Var(warn_deprecated) Init(1) Warning
 Warn if a deprecated compiler feature, class, method, or field is used
Index: c-family/c-opts.c
===
--- c-family/c-opts.c   (revision 174624)
+++ c-family/c-opts.c   (working copy)
@@ -405,6 +405,7 @@ c_common_handle_option (size_t scode, co
   warn_sign_compare = value;
  warn_reorder = value;
   warn_cxx0x_compat = value;
+  warn_delnonvdtor = value;
}
 
   cpp_opts->warn_trigraphs = value;
Index: cp/init.c
===
--- cp/init.c   (revision 174624)
+++ cp/init.c   (working copy)
@@ -3421,6 +3421,25 @@ build_delete (tree type, tree addr, spec
}
  complete_p = false;
}
+ else if (warn_delnonvdtor && MAYBE_CLASS_TYPE_P (type)
+  && !CLASSTYPE_FINAL (type) && TYPE_POLYMORPHIC_P (type))
+   {
+ tree dtor;
+ dtor = CLASSTYPE_DESTRUCTORS (type);
+ if (!dtor || !DECL_VINDEX (dtor))
+   {
+ if (CLASSTYPE_PURE_VIRTUALS (type))
+   warning(OPT_Wdelete_non_virtual_dtor,
+   "deleting object of abstract class type %qT"
+   " which has non-virtual destructor"
+   " will cause undefined behaviour", type);
+ else
+   warning(OPT_Wdelete_non_virtual_dtor,
+   "deleting object of polymorphic class type %qT"
+   " which has non-virtual destructor"
+   " may cause undefined behaviour", type);
+   }
+   }
}
   if (VOID_TYPE_P (type) || !complete_p || !MAYBE_CLASS_TYPE_P (type))
/* Call the builtin operator delete.  */
Index: doc/invoke.texi
===
--- doc/invoke.texi (revision 174624)
+++ doc/invoke.texi (working copy)
@@ -2331,6 +2331,15 @@ Warn when a class seems unusable because
 destructors in that class are private, and it has neither friends nor
 public static member functions.
 
+@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
+@opindex Wdelete-non-virtual-dtor
+@opindex Wno-delete-non-virtual-dtor
+Warn when @samp{delete} is used to destroy an instance of a class which
+has virtual functions and non-virtual destructor. It is unsafe to delete
+an instance of a derived class through a pointer to a base class if the
+base class does not have a virtual destructor.  This warning is enabled
+by @option{-Wall}.
+
 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
 @opindex Wnoexcept
 @opindex Wno-noexcept
Index: testsuite/g++.dg/warn/delete-non-virtual-dtor.C
===
--- testsuite/g++.dg/warn/delete-non-virtual-dtor.C (revision 0)
+++ testsuite/g++.dg/warn/delete-non-virtual-dtor.C (revision 0)
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x -Wdelete-non-virtual-dtor" }
+// { dg-do compile }
+
+struct polyBase { virtual void f(); };
+
+void f(polyBase* p, polyBase* arr)
+{
+  delete p;  // { dg-warning "non-virtual destructor may" }
+  delete [] arr;
+}
+
+struct polyDerived : polyBase { };
+
+void f(polyDerived* p, polyDerived* arr)
+{
+  delete p;  // { dg-warning "non-virtual destructor may" }
+  delete [] arr;
+}
+
+struct absDerived : polyBase { virtual void g() = 0; };
+
+void f(absDerived* p, absDerived* arr)
+{
+  delete p;  // { dg-warning "non-virtual destructor will" }
+  delete [] arr;
+}
+
+struct finalDerived final : polyBase { };
+
+void f(finalDerived* p, finalDerived* arr)
+{
+  delete p;  // no error for final classes
+  delete [] arr;
+}
+
+struct safeBase { virtual ~safeBase(); };
+struct safeDerived : safeBase { virtual void f(); };
+
+void f(safeDerived* p, safeDerived* arr)
+{
+  delete p;  // no error because base has virtual dtor
+  delete [] arr;
+}
+


Re: [trunk<-vta] Re: [vtab] Permit coalescing of user variables

2011-06-04 Thread Alexandre Oliva
On Oct 13, 2009, Alexandre Oliva  wrote:

> On Jun  1, 2009, Alexandre Oliva  wrote:
>> A long time ago, when variable tracking at assignments was just a
>> distant dream, we ran into one of the first contentious points, which
>> had to do with coalescing SSA names on copyrename.

>> On the one hand, coalescing unrelated SSA names made for better code (at
>> least in theory) but poorer debug information; on the other hand,
>> refraining from coalescing them exploded compile-time memory use.

>> We currently implement a trade-off by which variables inlined from other
>> functions can be coalesced, so as to save compile-time memory, reduce
>> abstraction penalties and retain debug information for out-of-line
>> functions.

>> The patch below (ping) implements two other possibilities: refraining
>> from coalescing even inlined SSA names, which might enable better debug
>> information to be generated, and enabling coalescing of all related
>> variables, for better code at the expense of debug information.

>> VTA doesn't really care which of the 3 possibilities is used, it works
>> equally well with all of them.

> On Jun  1, 2009, Alexandre Oliva  also wrote:

>> And the patch below changes the default so that we can optimize more.

> This patch combines the two patches described above, now that VTA is
> enabled by default.

This is an updated version of the patch, adjusting the testcases that
didn't expect this kind of variable coalescing.  Regstrapped on
x86_64-linux-gnu and i686-linux-gnu, along with a patch for a latent
cprop problem that caused a compare-debug failure in the ada rts.
Ok to install?

for  gcc/ChangeLog
from  Alexandre Oliva  

	* common.opt (ftree-coalesce-inlined-vars): New.
	(ftree-coalesce-vars): New.
	* doc/invoke.texi: Document them.
	* tree-ssa-copyrename.c (copy_rename_partition_coalesce):
	Implement them.

for  gcc/testsuite/ChangeLog
from  Alexandre Oliva  

	* g++.dg/tree-ssa/ivopts-2.C: Adjust for coalescing.
	* gcc.dg/tree-ssa/forwprop-11.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-1.c: Likewise.
	* gcc.dg/guality/bswaptest.c: Avoid coalescing and early death
	of test variable.
	* gcc.dg/guality/clztest.c: Likewise.
	* gcc.dg/guality/ctztest.c: Likewise.
	* gcc.dg/guality/rotatetest.c: Likewise.

Index: gcc/common.opt
===
--- gcc/common.opt.orig	2011-06-04 09:00:30.005102549 -0300
+++ gcc/common.opt	2011-06-04 09:01:29.199347556 -0300
@@ -1898,6 +1898,14 @@ ftree-ch
 Common Report Var(flag_tree_ch) Optimization
 Enable loop header copying on trees
 
+ftree-coalesce-inlined-vars
+Common Report Var(flag_ssa_coalesce_vars,1) Init(2) RejectNegative Optimization
+Enable coalescing of copy-related user variables that are inlined
+
+ftree-coalesce-vars
+Common Report Var(flag_ssa_coalesce_vars,2) Optimization
+Enable coalescing of all copy-related user variables
+
 ftree-copyrename
 Common Report Var(flag_tree_copyrename) Optimization
 Replace SSA temporaries with better names in copies
Index: gcc/tree-ssa-copyrename.c
===
--- gcc/tree-ssa-copyrename.c.orig	2011-06-04 09:00:30.160103200 -0300
+++ gcc/tree-ssa-copyrename.c	2011-06-04 09:01:29.252347770 -0300
@@ -194,20 +194,21 @@ copy_rename_partition_coalesce (var_map 
   ign1 = TREE_CODE (root1) == VAR_DECL && DECL_IGNORED_P (root1);
   ign2 = TREE_CODE (root2) == VAR_DECL && DECL_IGNORED_P (root2);
 
-  /* Never attempt to coalesce 2 user variables unless one is an inline
- variable.  */
+  /* Refrain from coalescing user variables, if requested.  */
   if (!ign1 && !ign2)
 {
-  if (DECL_FROM_INLINE (root2))
+  if (flag_ssa_coalesce_vars && DECL_FROM_INLINE (root2))
 ign2 = true;
-  else if (DECL_FROM_INLINE (root1))
+  else if (flag_ssa_coalesce_vars && DECL_FROM_INLINE (root1))
 	ign1 = true;
-  else
+  else if (flag_ssa_coalesce_vars != 2)
 	{
 	  if (debug)
 	fprintf (debug, " : 2 different USER vars. No coalesce.\n");
 	  return false;
 	}
+  else
+	ign2 = true;
 }
 
   /* If both values have default defs, we can't coalesce.  If only one has a
Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi.orig	2011-06-04 09:00:30.665105322 -0300
+++ gcc/doc/invoke.texi	2011-06-04 09:01:29.479348698 -0300
@@ -395,8 +395,8 @@ Objective-C and Objective-C++ Dialects}.
 -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
 -fsplit-wide-types -fstack-protector -fstack-protector-all @gol
 -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
--ftree-bit-ccp @gol
--ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
+-ftree-bit-ccp -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
+-ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol
 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
 -ftree-forwprop -ftree-fre -ftree-loop-if-c

Have a boehm-gc patch for gcj/rtems

2011-06-04 Thread Jie Liu
Hi,

I am working on porting gcj to rtems now, it's a project of GSoC2011.[1]
And now, the first step: boehm-gc have been ported,  so I want to get
this patch reviewed and merged.

And I have filed the FSF Paperwork, the patch has been attached.
Thank you for your time.

Best Regards,
Jie

[1]http://socghop.appspot.com/gsoc/org/google/gsoc2011/rtems


boehm-gc.diff
Description: Binary data


Re: [wwwdocs] Buildstat update for 4.4

2011-06-04 Thread Gerald Pfeifer
On Fri, 3 Jun 2011, Tom G. Christensen wrote:
> Latest results for 4.4.x.

Thanks, Tom.

Gerald


Re: [build] Move ENABLE_EXECUTE_STACK to toplevel libgcc

2011-06-04 Thread Andreas Schwab
Rainer Orth  writes:

> * FreeBSD uses the unmodified address passed to __enable_execute_stack
>   to call mprocted, while all others round both address and size to a
>   pagesize boundary.  I cannot imagine that FreeBSD supports
>   byte-granularity mprotect, so this seems an oversight.

Apparently freebsd's mprotect aligns the address by itself, so it will
not make any difference.  At least linux's mprotect will barf if the
address is unaligned.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [build] Move ENABLE_EXECUTE_STACK to toplevel libgcc

2011-06-04 Thread Gerald Pfeifer
On Fri, 3 Jun 2011, Rainer Orth wrote:
> * FreeBSD uses the unmodified address passed to __enable_execute_stack
>   to call mprocted, while all others round both address and size to a
>   pagesize boundary.  I cannot imagine that FreeBSD supports
>   byte-granularity mprotect, so this seems an oversight.

The man page of mprotect on FreeBSD 9 (the next release) states the
following which seems supportive of your theory:

  NAME
 mprotect -- control the protection of pages
  :
  DESCRIPTION
 The mprotect() system call changes the specified pages to have protection
 prot.  Not all implementations will guarantee protection on a page basis;
 the granularity of protection changes may be as large as an entire
 region.  A region is the virtual address space defined by the start and
 end addresses of a struct vm_map_entry.


Gerald


Re: [PR debug/47624] improve value tracking in non-VTA locations

2011-06-04 Thread Alexandre Oliva
On Feb 15, 2011, Alexandre Oliva  wrote:

> VTA only tracks locations of gimple regs, while addressable variables
> still use the old var tracking strategy.  This means addressable
> variables, during var-tracking, got locations that were not based on
> VALUEs, which failed immediately in the presence of auto-inc addresses.
> The locations also tended to degrade in other ways, when a register
> holding an address happened to be overwritten at a later point.

> This patch arranges for us to track addresses of these variables as
> VALUEs, and to emit new locations for them when a location whose value
> was used to compute its address changes, fixing the problem.

> The patch was regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok to
> install?

Ping?  Retested on both platforms, unchanged except for fixing the typo
s/deug/debug/ in the ChangeLog entry, that Jakub caught.
http://gcc.gnu.org/ml/gcc-patches/2011-02/msg00981.html

> for  gcc/ChangeLog
> from  Alexandre Oliva  

>   PR deug/47624
>   * var-tracking.c (add_stores): Add FIXME note.
>   (compute_bb_dataflow): Use value-based locations in MO_VAL_SET.
>   (emit_notes_in_bb): Likewise.
>   (check_changed_vars_4): New.
>   (emit_noets_for_changes): Call it.

-- 
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: [wwwdocs] Buildstat update for 4.3

2011-06-04 Thread Gerald Pfeifer
On Fri, 3 Jun 2011, Tom G. Christensen wrote:
> Latest results for 4.3.x.

Thanks, applied.

Gerald


Re: Initialize previous in read_state_param_structs

2011-06-04 Thread Alexandre Oliva
On Jun  4, 2011, Jack Howarth  wrote:

> Since your original patch was approved, are you checking in
> http://gcc.gnu.org/ml/gcc-patches/2011-05/msg02304.html? Currently the
> -O3 bootstrap is still broken without it.

This one was already installed, but there's another problem that
prevents -O3 bootstrap still pending review.

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

-- 
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