[PATCH] avoid scheduling volatiles across sequence points
Geoff Keating
geoffk@geoffk.org
Fri May 31 12:25:00 GMT 2002
> From: Eric Christopher <echristo@redhat.com>
> Cc: gcc-patches@gcc.gnu.org
> Date: 31 May 2002 11:04:21 -0700
> I guess I was misreading this then?
>
> http://gcc.gnu.org/onlinedocs/gcc/Volatiles.html
>
> "The minimum either standard specifies is that at a sequence point all
> previous accesses to volatile objects have stabilized and no subsequent
> accesses have occurred. Thus an implementation is free to reorder and
> combine volatile accesses which occur between sequence points, but
> cannot do so for accesses across a sequence point."
>
> This sounded like if a volatile was accessed both before and after a
> sequence point that the sequence point had to stay there for it to be
> valid.
A sequence point isn't externally visible. What this paragraph really
means is that if you make two volatile accesses between sequence
points:
volatile int a, b;
(void)(a++ + b++);
then it doesn't matter whether the write to 'a' happens before or
after the write to 'b'. At present, though, we don't reorder volatile
accesses at all, correct?
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>
More information about the Gcc-patches
mailing list