This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/68764] C frontend does not fold away trivial expressions that refer to const variables


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68764

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #2)
> (In reply to Marek Polacek from comment #1)
> > I agree that this is weird but this is something the C FE likely shouldn't
> > do.
> 
> One (possibly minor) obstacle with doing it in the middle-end is that the
> DECL_INITIALs of non-static local variables are cleared during
> gimplification so it is not all that simple to look up the definition of a
> const variable in order to fold away its uses.

Only if explicit assignments are instead added.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]