This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlined as trees
- From: Geert Bosch <bosch at gnat dot com>
- To: Linus Torvalds <torvalds at transmeta dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>, <jason at redhat dot com>
- Date: Fri, 7 Dec 2001 13:59:08 -0500
- Subject: Re: Volatile MEMs in statement expressions and functions inlined as trees
On Thursday, December 6, 2001, at 11:09 , Linus Torvalds wrote:
> If we store 0 to 'x' (whether 'x' is volatile or not), then the "value
> stored" is 0. Always, and without fail. Regardless of what we'd get if
> we read something back from 'x'. Agreed?
>
> If we store 0 to 'x', and the standard said that the returned value is
> equivalent to the "value of x after storing", then for a volatile 'x' a
> compiler would clearly have to re-load the value.
>
> As it is, I would read it as _not_ re-loading the value, but I'll also
> admit to it maybe be semantic hair-splitting.
Right, given the exact language in the standard, it would be wrong
to reload
the value from a volatile variable, as in that case we might return
a different
value from the one stored.
-Geert