This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR tree-optimization/35494: [4.4 Regression]: Revision 132991 breaks 483.xalancbmk
On Sat, Mar 8, 2008 at 3:31 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>
>
> Sent from my iPhone
>
>
>
> On Mar 8, 2008, at 15:15, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>
> > On Sat, Mar 08, 2008 at 09:44:13PM +0100, Richard Guenther wrote:
> >> On Fri, Mar 7, 2008 at 11:07 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> >>> On Fri, Mar 7, 2008 at 11:11 AM, H.J. Lu <hjl.tools@gmail.com>
> >>> wrote:
> >>>> Compiler will allocate space for
> >>>>
> >>>> const int conststaticvariable;
> >>>>
> >>>> You just may not know what value will be in all cases. Here is the
> >>>> updated with additional testcases. OK to install if tests on
> >>>> Linux/x86
> >>>> and Linux/Intel64 as well as 483.xalancbmk passes?
> >>>>
> >>>
> >>> All tests are passed. OK to install on trunk?
> >>
> >> Yes.
> >>
> >
> > It turns out to be a tricky issue. We need to check if a read-only
> > symbol may be overridden at both run time and link time. I can't
> > use targetm.binds_local_p since it only tells me if a symbol may be
> > overridden at run time by another module. It returns fals positive
> > for
> >
> > class Foo {
> > public:
> > static const int erf = 0;
> > };
> >
> > since C++ sets DECL_EXTERNAL to 1. Also it doesn't tell me if a
> > symbol may be overridden by another definition at link time. I
> >
> > I opened PR 35501 for run time issue. I am testing this patch for
> > both PR 35494 and 35501 on Linux/ia32 and Linux/Intel as well as
> > 483.xalancbmk. OK to install if all tests pass?
> >
> >
> > H.J.
> > ---
> > gcc/
> >
> > 2008-03-08 H.J. Lu <hongjiu.lu@intel.com>
> >
> > PR tree-optimization/35501
> > * c-typeck.c (decl_constant_value): Check if value may be
> > overriden at run time.
> > * tree-ssa-sccvn.c (try_to_simplify): Likewise.
> >
> > PR tree-optimization/35494
> > PR tree-optimization/35501
> > * tree-ssa-ccp.c (get_symbol_constant_value): Check if value
> > may be overriden at link and run time.
> >
> > gcc/testsuite/
> >
> > 2008-03-07 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.
> >
> > PR tree-optimization/35501
> > * gcc.dg/pr35501-1.c: New.
> > * gcc.dg/pr35501-2.c: Likewise.
> > * gcc.dg/pr35501-3.c: Likewise.
> > * gcc.dg/pr35501-4.c: Likewise.
> >
> > --- gcc/c-typeck.c.local 2008-02-26 09:27:22.000000000 -0800
> > +++ gcc/c-typeck.c 2008-03-08 14:44:29.000000000 -0800
> > @@ -1551,7 +1551,10 @@ decl_constant_value (tree decl)
> > or a variable, then re-evaluating it could give different
> > results. */
> > && TREE_CONSTANT (DECL_INITIAL (decl))
> > /* Check for cases where this is sub-optimal, even though
> > valid. */
> > - && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR)
> > + && TREE_CODE (DECL_INITIAL (decl)) != CONSTRUCTOR
> > + /* Check if it may be overriden at run time. */
> > + && (!flag_shlib
> > + || DECL_VISIBILITY (decl) != VISIBILITY_DEFAULT))
> > return DECL_INITIAL (decl);
>
> This is only true with elf semantics; mach-o semantics say that a
> variable in a shared library is not overwritable.
>
>
Do we have a function which returns if a definition may be overridden
at run-time?
H.J.