https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118085
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
Keywords| |wrong-code
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
There are likely other flags (flag_wrapv) also used without proper context.
All of these flags would need to be reflected into the IL or all fold invokers
set a cfun or alternatively, fold needs to treat !cfun conservatively when
those flags are queried. The flags are aliased to global_options.x_* which
IIRC is updated from cfun at set-cfun time.
We might possibly want sth like a opt_for_cfun_or
(flag_delete_null_pointer_checks, false), thus when !cfun, use a conservative
setting. (there might not be a conservative setting for all flags, so
some foldings might want to disable themselves without cfun)
Only for GENERIC trees in global initializers the "global options" are the
correct ones.