This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Clarification on Gcc's strict aliasing rules
>>> int f() {
>>> union a_union t;
>>> int* ip;
>>> t.d = 3.0;
>>> ip = &t.i;
>>> return *ip;
>>> }
>>>
>>> could you tell me what the effective type of 't.i' object ?
>>
>> int, if you can say that object exists at all: it does not have a stored
>> value. The stored value of t is a double with value 3.0 . You can
>> take its address and access it via that as "double" (or "char"), or you
>> can access it as the union it is. You can not access it as "int".
>
> BTW, does your reasoning rely on the C standard ?
Of course it does. Perhaps I don't understand what you're asking here.
> If so could you let me know which parts exactly ?
C99 6.5/6 defines effective type. 6.5/7 says what accesses are allowed.
If you care about C90 as well, please look it up yourself, I don't have
those docs handy.
Segher