https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80728
--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 15 May 2017, amonakov at gcc dot gnu.org wrote: > 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. I think the IPA reference bug came across in another PR already, given that IPA reference lacks references to unknown targets (it only records direct decl references) I can't see how to easily fix this... Well. With a flag obviously, but that must be already there somehow given pointer dereferences are not recorded either.