This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: volatile semantics
- From: Paul Schlie <schlie at comcast dot net>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Daniel Berlin <dberlin at dberlin dot org>,Gabriel Dos Reis <gdr at integrable-solutions dot net>,"D. Hugh Redelmeier" <hugh at mimosa dot com>,<gcc at gcc dot gnu dot org>
- Date: Sun, 17 Jul 2005 21:29:11 -0400
- Subject: Re: volatile semantics
> Note that I'm explicitly not taking a position on what the standard says.
> The standard is notoriously incomplete with respect to object model issues,
> including volatility, so I think that trying particularly hard to parse its
> words in this area is probably not a good use of time for people trying to
> build a real-world compiler. Creating DRs is more useful than trying to read
> the tea leaves.
>
> Clearly, the analogous rule does not make sense for "const" in that a "const"
> object can never be modified; in particular, if the compiler can prove that
> "*x = 3" is an attempt to modify an object whose dynamic type is "const int",
> then it can replace that with a call to "kill (SIGSEGV)", if it likes; this
> is unquestionably undefined behavior.
With all due respect, unless there is an explicit reference in the standard
to contradict it's clearly stated requirement that an object's qualified
lvalue ("locator value") designates the object being referenced, all
interpretations to the contrary are at best presumptuous, regardless of
whether or not it's generalized behavior may be indeterminate.
(but regardless, at least things are successively approximating "correct")