This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]