Revision 132991: http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00445.html breaks 483.xalancbmk in SPEC CPU 2006 on Linux/Intel64 with -O2 -ffast-math. I got Running 483.xalancbmk ref base o2 default 483.xalancbmk: copy #0 non-zero return code (rc=0, signal=6) **************************************** Contents of ref.err **************************************** terminate called after throwing an instance of 'xercesc_2_5::DOMException' **************************************** That optimization may not be valid for C++ code.
Subject: Re: New: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk This is most likely the c++ front-end setting readonly when it should not. Sent from my iPhone On Mar 6, 2008, at 22:06, "hjl dot tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org > wrote: > Revision 132991: > > http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00445.html > > breaks 483.xalancbmk in SPEC CPU 2006 on Linux/Intel64 > with -O2 -ffast-math. I got > > Running 483.xalancbmk ref base o2 default > > 483.xalancbmk: copy #0 non-zero return code (rc=0, signal=6) > > > **************************************** > Contents of ref.err > **************************************** > terminate called after throwing an instance of > 'xercesc_2_5::DOMException' > > **************************************** > > That optimization may not be valid for C++ code. > > > -- > Summary: [4.4 Regression]: Revision 132991 breaks > 483.xalancbmk > Product: gcc > Version: 4.4.0 > Status: UNCONFIRMED > Severity: major > Priority: P3 > Component: tree-optimization > AssignedTo: unassigned at gcc dot gnu dot org > ReportedBy: hjl dot tools at gmail dot com > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35494 > > ------- You are receiving this mail because: ------- > You are on the CC list for the bug, or are watching someone who is.
Will probably happen in cases like static const int i = foo(); ?
Are bash-3.2$ cat y.cc class bar { public: static const int conststaticvariable; }; int f(void) { return bar::conststaticvariable; } bash-3.2$ cat z.cc extern int foo (void); class bar { public: static const int conststaticvariable; }; const int bar::conststaticvariable = foo (); bash-3.2$ valid C++ program?
(In reply to comment #1) > Subject: Re: New: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk > > This is most likely the c++ front-end setting readonly when it should > not. > I think you should check a symbol is both readonly and local. conststaticvariable in --- class bar { public: static const int conststaticvariable; }; --- is global, not local.
Subject: Re: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk On Fri, 7 Mar 2008, hjl dot tools at gmail dot com wrote: > ------- Comment #4 from hjl dot tools at gmail dot com 2008-03-07 14:03 ------- > (In reply to comment #1) > > Subject: Re: New: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk > > > > This is most likely the c++ front-end setting readonly when it should > > not. > > > > I think you should check a symbol is both readonly and local. > conststaticvariable in > > --- > class bar > { > public: > static const int conststaticvariable; > }; > --- > > is global, not local. Yep, and yes, the example was valid. Richard.
This patch --- tree-ssa-ccp.c.local 2008-03-06 14:18:27.000000000 -0800 +++ tree-ssa-ccp.c 2008-03-07 06:21:57.000000000 -0800 @@ -306,9 +306,10 @@ get_symbol_constant_value (tree sym) if (val && ccp_decl_initial_min_invariant (val)) return val; - /* Variables declared 'const' without an initializer + /* Local variables declared 'const' without an initializer have zero as the intializer. */ if (!val + && !TREE_PUBLIC (sym) && (INTEGRAL_TYPE_P (TREE_TYPE (sym)) || SCALAR_FLOAT_TYPE_P (TREE_TYPE (sym)))) return fold_convert (TREE_TYPE (sym), integer_zero_node); works on small C++ testcase. I will try 483.xalancbmk next.
My patch works on 483.xalancbmk with test input. I am running with ref input.
Another testcase in C: --- const int conststaticvariable; int f(void) { return conststaticvariable; } --- Can we assume conststaticvariable will be 0?
A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00466.html
Subject: Re: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk On Fri, 7 Mar 2008, hjl dot tools at gmail dot com wrote: > > > ------- Comment #8 from hjl dot tools at gmail dot com 2008-03-07 14:56 ------- > Another testcase in C: > > --- > const int conststaticvariable; > > int f(void) > { > return conststaticvariable; > } > --- > > Can we assume conststaticvariable will be 0? No.
The current patch is http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00572.html
The current patch is http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00631.html
Subject: Bug 35494 Author: hjl Date: Mon Mar 10 18:20:23 2008 New Revision: 133082 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133082 Log: gcc/ 2008-03-10 H.J. Lu <hongjiu.lu@intel.com> PR tree-optimization/35494 * tree-ssa-ccp.c (get_symbol_constant_value): Check if value may be overriden at link and run time. gcc/testsuite/ 2008-03-10 H.J. Lu <hongjiu.lu@intel.com> PR tree-optimization/35494 * g++.dg/tree-ssa/ssa-store-ccp-1.C: New. * gcc.dg/tree-ssa/ssa-store-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-store-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-store-ccp-4.c: Likewise. Added: trunk/gcc/testsuite/g++.dg/tree-ssa/ssa-store-ccp-1.C trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-2.c trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-3.c trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-store-ccp-4.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-ccp.c
Fixed.