This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/53436] Volatile behaves strange with OpenMP
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 24 May 2012 22:31:58 +0000
- Subject: [Bug tree-optimization/53436] Volatile behaves strange with OpenMP
- Auto-submitted: auto-generated
- References: <bug-53436-4@http.gcc.gnu.org/bugzilla/>
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.