This is the mail archive of the
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlined astrees
- From: Jason Merrill <jason at redhat dot com>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: schwab at suse dot de, gcc-patches at gcc dot gnu dot org, torvalds at transmeta dot com
- Date: Fri, 07 Dec 2001 01:20:38 +0000
- Subject: Re: Volatile MEMs in statement expressions and functions inlined astrees
- References: <10112062335.AA04722@vlsi1.ultra.nyu.edu>
>>>>> "Richard" == Richard Kenner <firstname.lastname@example.org> writes:
> 6.5.15 [#3] ... An assignment expression has the value of the left operand
> after the assignment, ...
> For me this implies that a volatile object must be reloaded.
> "has the value of" does not imply "is read from" to me. That can be read to
> say that it must have the same value *as if* it were re-read.
I agree, for C. To continue the quoted sentence, C99 says
An assignment expression has the value of the left operand after the
assignment, but is not an lvalue.
However, the C++ standard says
The result of the assignment operation is the value stored in the left
operand after the assignment has taken place; the result is an lvalue.
This seems a pretty clear distinction to me; in C++, *q should be read
after the store. In C, it should not. In neither language should anyone
write anything like the example if they're dealing with volatiles.