[cfe-dev] C++ and volatile lvalue-to-rvalue

Abramo Bagnara abramo.bagnara at gmail.com
Thu Oct 13 09:20:47 PDT 2011


Il 13/10/2011 17:33, Christopher Jefferson ha scritto:
> 
> On 13 Oct 2011, at 12:43, Abramo Bagnara wrote:
> 
>>
>> I want to put this gcc bug report to clang developer attention.
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50364
>>
>> 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.

We don't have a sequence point, but we have a partial ordering mandated
by the standard: the write should be done before the read (see 5.17p1).

Or you meant another source of undefined behaviour?

Note also that recent C++ standard no longer refers former "sequence
point" concept.



More information about the cfe-dev mailing list