This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/29753] [4.0/4.1/4.2/4.3 Regression] Volatile semantics ignored in some cases
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Nov 2006 21:33:19 -0000
- Subject: [Bug tree-optimization/29753] [4.0/4.1/4.2/4.3 Regression] Volatile semantics ignored in some cases
- References: <bug-29753-13526@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from mmitchel at gcc dot gnu dot org 2006-11-12 21:33 -------
This is a tricky case, since the underlying memory pointed to by the pointer is
non-volatile. In other words, the compiler knows that "s" is non volatile,
even though the pointer type is "volatile int *".
The C99 standard (5.1.2.3) says that "accessing a volatile object" is a
side-effect. The C++ standard ([basic.intro]), however, says that "accessing
an object designated by a volatile lvalue" is a side-effect. In this case, I
would think the object to be non-volatile, but the lvalue to be volatile.
How confusing!
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29753