This is the mail archive of the gcc@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]

Re: RFA: check_dbra_loop


On 13-May-2001, Mark Mitchell <mark@codesourcery.com> wrote:
> >>>>> "Richard" == Richard Kenner <kenner@vlsi1.ultra.nyu.edu> writes:
> 
>     Richard> Is this required even if "volatile" is not specified?
> 
> I don't know, but you're probably correct -- it's probably not
> required if `volatile' isn't specified.

As well as respecting `volatile', memory writes should IMHO also not be
reordered across thread synchronization primitives.  Otherwise I suspect
a lot of carefully written programs could break.

I don't know whether the standards are clear on this.  The C standard
doesn't say anything much about multithread.  Unfortunately the
description is divided between the Posix threads standard (which I don't
have a copy of), and the C standard.  That's assuming you're using Posix
threads, of course.  If you are instead using e.g. some OS-specific thread
synchronization routines, then the C standard doesn't really guarantee
anything, so it's up to the documentation of the OS-specific thread
stuff (which is probably doesn't say much about compiler reordering),
and the compiler's documentation (which probably doesn't say much about
reordering in the presence of multithreading).

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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