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 ipa/80728] IPA-reference suppresses compiler memory barrier


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

--- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Nowadays C has atomics and fences in the language standard, so it doesn't
matter if x() had

  asm volatile("":::"memory");

or

  __atomic_{signal,thread}_fence(__ATOMIC_ACQ_REL);

or

  return __atomic_load_n(&b, __ATOMIC_SEQ_CST);

In all three cases the compiler needs to place a memory barrier internally, and
in the latter two it's impossible to argue that the source code is missing a
clobber.

I think it's correct that "memory" clobber cannot touch non-addressable auto
vars, but extending that to static variables seems wrong. I'm not aware of any
instance (apart from this bug) where gcc does that.

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