------- 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