On Jun 19, 2011, at 4:24 PM, Eric Botcazou wrote:
>> if T is a non-volatile composite type with volatile components, and O is an
>> object of type T, are the optimizers allowed to remove the assignment "O :=
>> O"?
> 
> Good question, that I'm not really qualified to answer.  Any language lawyer?

I'd like to think that the optimizers are not allowed to remove the assignment 
(unless they synthesize of up the assignment of all volatile fields).  For 
unions, head explodes.  I think for unions, it can.  I could check the standard 
to ensure I have it right, but, well, that's annoying.  :-)  This answer is for 
the answer for C and C++, but, the middle end, _could_ decide to differ, if it 
had a compelling reason to.  I don't know of any reason.  Now, before someone 
tries to optimize structures, please be very careful.  Unions, transparent 
unions, frontend synthed structures with multiple offsets at the same location 
and the like come to mind.

Reply via email to