This is the mail archive of the
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlinedastrees
- From: Linus Torvalds <torvalds at transmeta dot com>
- To: Paul Schlie <schlie at mediaone dot net>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 14 Dec 2001 15:03:58 -0800 (PST)
- Subject: Re: Volatile MEMs in statement expressions and functions inlinedastrees
On Fri, 14 Dec 2001, Paul Schlie wrote:
> rvalue :: (temp = rvalue, temp)
> lvalue = rvalue :: lvalue = (temp = rvalue, temp)
> q = p = x :: q = (p = (x)) :: q = (temp2 = (p = (temp1 = x, temp1)), temp2)
> equivalent to:
> q = p = x :: q = (p = (temp = x, temp), temp)
Whee. I like the chain of logic, and it would be irrefutable (I think) if
it wasn't for the fact that I suspect Gabriel may object to one of your
steps, namely the basic
"lvalue = rvalue".
Gabriels claim hinges on the assignment of
lvalue = lvalue
which means that your chain of logic, while unbroken in itself, is not the
same chain of logic that Gabriel looks at and worries about.
(Hey, _I_ like your chain, because it ends up where I want, but "like" is
not a mathematical proof)
So there's an additional step:
q = p = x ::
lvalue = (rvalue-conversion) lvalue = (rvalue-conversion) x
where I think the "rvalue-coversion" is just the middle "result" (ie the
infamous "value stored"), but Gabriel claims that the middle "result" is
thrown away, and the rvalue-conversion is the dereferencing of the lvalue.
Which is how Gabriel comes up with an extra dereference.
Now, if you can logically refute _that_, I'd love to hear about it. I've
tried to refute it by trying to show that throwing out the "result is
value stored" means that that part of the standard appears to have no
value, but Gabriel doesn't care. He still maintains that the lvalue-rvalue
conversion has to explicitly happen, and involves a dereference, not just
the "value stored".
(and because it's a lvalue, you cannot do the
rvalue :: (temp = rvalue, temp)
operation, which is why your logic won't convince him).