[cfe-dev] C++ and volatile lvalue-to-rvalue
schaub.johannes at googlemail.com
Wed Oct 19 12:33:34 PDT 2011
Christopher Jefferson wrote:
> On 13 Oct 2011, at 12:43, Abramo Bagnara wrote:
>> I want to put this gcc bug report to clang developer attention.
>> The gcc developers believe that according to the standard
>> volatile int v;
>> x = v = 3;
>> does not imply necessarily a read from v.
> If you want to argue that this should both write to, and read from v, then
> I think you fall foul of lack of a sequence point, so the behaviour is
> undefined anyway.
As clarified by Abramo, the assignment and the read from v are sequenced.
However the following would be undefined behavior:
volatile int v = 0;
int x = v + v;
Note how "v + v" does two side effects on v, and these side effects are not
More information about the cfe-dev