[Bug tree-optimization/53436] Volatile behaves strange with OpenMP
ebotcazou at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 24 22:34:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53436
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot
| |gnu.org
--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-05-24 22:31:58 UTC ---
> Yes, I get, that it's not a good way to do things, as (among other reasons) a
> volatile access is no memory fence. So accesses to other locations may not be
> ordered. But just for the sake of correctness, accesses should be ordered, if
> they all go to volatile variables, no? From the C99-standard, section 5.1.2.3:
>
> > At sequence points, volatile objects are stable in the sense that previous accesses are complete and subsequent accesses have not yet occurred.
>
> This means buffering the reads to the volatile variable over multiple
> iterations of the while loop is not allowed, or do I get this wrong?
You cannot invoke the C99 standard when there is concurrency in your program,
as the standard doesn't deal with it at all.
More information about the Gcc-bugs
mailing list