RFA: check_dbra_loop
Fergus Henderson
fjh@cs.mu.oz.au
Sun May 13 11:06:00 GMT 2001
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.
More information about the Gcc
mailing list