This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fno-tree-cselim not working?
Ian Lance Taylor writes:
> Andrew Haley <aph-gcc@littlepinkcloud.COM> writes:
>
> > The problem is code like this:
> >
> > int counter;
> >
> > ...
> >
> > if (we_hold_counters_mutex)
> > counter++;
> >
> > This is legal POSIX threads code: counter is not accessed when we do
> > not hold the mutex. According to POSIX we do not have to declare
> > volatile memory that we only access when we hold a mutex.
>
> Where does POSIX say that?
I think that's just the point: POSIX doesn't directly state it, but it
implies it. The exact language used by POSIX is rather vague, and is
discussed at length in H. Boehm, ``Threads Cannot Be Implemented As a
Library'', http://www.hpl.hp.com/techreports/2004/HPL-2004-209.html.
This paper was quite enough to convince me.
Andrew.