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 middle-end/72795] Missed optimization of external-linkage variables in presence of barriers


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.

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