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 astrees


>>>>> "Richard" == Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 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.

Jason


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