Clarification on Gcc's strict aliasing rules

Andrew Haley aph@redhat.com
Fri Nov 12 17:11:00 GMT 2010


On 11/12/2010 04:42 PM, Segher Boessenkool wrote:
>> But you finally said
>>
>>     - you can not access it as int:
>>
>>         that object (t.i) does not have a stored value therefore it
>>         doesn't exist.
> 
> (Your words, not mine -- and such sloppy wording gets you into trouble,
> the standard does not talk about any of this.  It is one way of looking
> at it though).
> 
>> This is what I understood from what you said, please correct me if I'm
>> wrong.
>>
>> However doing:
>>
>>      int i = t.i;
>>
>> is defined in C (as long as there's no trap representation) even if 't.i'
>> object has no stored value.
> 
> Actually, I think this is a GCC extension, and I was mistaken to say it
> is valid C99 before.

Right, that's my understanding too.

Andrew.



More information about the Gcc-help mailing list