In article <news:6a******* *************@i swest.net>
John Temples <us****@xargs-spam.com> wrote:
[trimmed]
extern volatile unsigned char v;
v;
My understanding is that that "v;" is an expression statement which
should be "evaluated" as a void expression for side effects ...
I have some compilers which do and some compilers which do not access
"v" with the above code.
Here is a quote from a C99 draft (wording essentially unchanged from
the original 1989 ANSI C standard):
[#6] An object that has volatile-qualified type may be
modified in ways unknown to the implementation or have other
unknown side effects. Therefore any expression referring to
such an object shall be evaluated strictly according to the
rules of the abstract machine, as described in 5.1.2.3.
Furthermore, at every sequence point the value last stored
in the object shall agree with that prescribed by the
abstract machine, except as modified by the unknown factors
mentioned previously.99 What constitutes an access to an
object that has volatile-qualified type is implementation-
defined.
The last sentence is the key here: the implementation' s documentation
must state what make something an "access" to a volatile-qualified-type
object like "v".
So, open up the documentation that came with your compiler, see
whether it says "v;" constitutes an "access", and you will find
out whether the compiler should have generated one.
(In practice, given the option, I personally would reject -- or at
least seriously downgrade -- any compiler that does not attempt to
"load v" here, regardless of the contents of the implementation
document. Of course, one must often trade off obnoxious compiler
behavior against required compiler features. But if the document
says "v;" is an access, and the compiler generates no code, you have
obvious grounds for a bug report, at least.)
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.