This is the mail archive of the
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlinedastrees
- From: Jason Merrill <jason at redhat dot com>
- To: Linus Torvalds <torvalds at transmeta dot com>
- Cc: Alexandre Oliva <aoliva at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 16 Dec 2001 01:48:03 +0000
- Subject: Re: Volatile MEMs in statement expressions and functions inlinedastrees
- References: <Pine.LNX.firstname.lastname@example.org>
>>>>> "Linus" == Linus Torvalds <email@example.com> writes:
>> > I further claim that NOWHERE does the standard say that the "lvalue to
>> > rvalue conversion" is an "access". Show me. I've quoted the passage, and
>> > I've pointed out that nowhere in the definition of "lvalue-rvalue"
>> > conversion does it _ever_ say anything about accessing the object
>> > associated with the lvalue.
>> But what else *could* it mean?
> It could easily mean that some expressions have the rvalue in and of
> themselves, like an assignment.
I don't see how you can conclude that from [conv.lval]. It says,
The value contained in the object indicated by the lvalue is the rvalue
For non-volatile variables, if we already know that value for some reason,
we don't need to look inside the object. But for volatiles, we can't know
the value, so we need to fetch it again.
> See, assignments are special. They inherently access the object in
> themselves. You don't _need_ any other "access" to know what the value is.
> Which means that they are also the only operation where the "lvalue to
> rvalue conversion" does not have to involve an access.
> See my argument?
Yes, but I don't see anything in the text to suggest that assignment is
special in this way. I can understand the desire to make it so with some
sort of lvalue-rvalue duality as Alexandre has been suggesting, and as
Erwin suggested toward the end of the issue discussion, but I don't see how
you can read that into the existing text.
And I don't see why 'p = q = 42' is an important enough case to merit
special handling. For a plain assignment, which is all anyone should be
doing with volatiles, this doesn't matter.