This is the mail archive of the
mailing list for the GCC project.
Re: Optimization of conditional access to globals: thread-unsafe?
- From: Ian Lance Taylor <iant at google dot com>
- To: "Diego Novillo" <dnovillo at google dot com>
- Cc: "Michael Matz" <matz at suse dot de>, gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: 26 Oct 2007 15:20:01 -0700
- Subject: Re: Optimization of conditional access to globals: thread-unsafe?
- References: <firstname.lastname@example.org> <email@example.com> <20071026143334.GA5041@moonlight.home> <firstname.lastname@example.org> <20071026155101.GB5041@moonlight.home> <016201c817e9$5454edd0$2e08a8c0@CAM.ARTIMI.COM> <20071026161739.GC5041@moonlight.home> <Pine.LNX.email@example.com> <firstname.lastname@example.org> <email@example.com>
"Diego Novillo" <firstname.lastname@example.org> writes:
> On 26 Oct 2007 14:24:21 -0700, Ian Lance Taylor <email@example.com> wrote:
> > What do people think of this patch? This seems to fix the problem
> > case without breaking Michael's case. It basically avoids store
> > speculation: we don't write to a MEM unless the function
> > unconditionally writes to the MEM anyhow.
> I think it couldn't hurt. Providing it as a QOI feature might be
> good. However, we should predicate these changes on a -fthread-safe
> flag. More and more of these corner cases will start popping up.
It appears that the draft C++0x memory model prohibits speculative
Therefore I now think we should aim toward prohibiting them
unconditionally. That memory model is just a draft. But I think we
should implement it unconditionally when it exists.