This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/80728] IPA-reference suppresses compiler memory barrier
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 15 May 2017 09:49:32 +0000
- Subject: [Bug ipa/80728] IPA-reference suppresses compiler memory barrier
- Auto-submitted: auto-generated
- References: <bug-80728-4@http.gcc.gnu.org/bugzilla/>
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.