[Bug middle-end/72795] Missed optimization of external-linkage variables in presence of barriers
peter at cordes dot ca
gcc-bugzilla@gcc.gnu.org
Wed Aug 3 18:13:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72795
Peter Cordes <peter at cordes dot ca> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |peter at cordes dot ca
--- Comment #1 from Peter Cordes <peter at cordes dot ca> ---
This is not a bug. Adding int gety(){ return y; } to the compilation unit
leads to the same asm for f() and g(). (https://godbolt.org/g/4z94YZ). It can
only be optimized away when there are no observers.
f() and g() have side-effects on global / static variables which of course
can't be optimized away.
BTW, this came up based on http://stackoverflow.com/a/38741832/224132.
More information about the Gcc-bugs
mailing list