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

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-26 
23:08:50 UTC ---
(In reply to comment #7)
> (In reply to comment #6)
> 
> > No.  The optimization passes that are remotely related do not work
> > flow or context sensitive, so we don't know whether the initialization
> > takes place unless it is a static initializer.
> 
> What about the case where there is a static initializer and another assignment
> that assigns the same value as the static initializer?

We don't currently handle this case - we'd need to remove the store as
dead to be able to promote the static variable to const (only then we
will be able to optimize reads from it).  The pass that is doing the
related work is ipa-reference.c.

Reply via email to