This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC aliasing rules: more aggressive than C99?
On 01/05/2010 03:23 PM, Vincent Lefevre wrote:
> On 2010-01-05 10:31:13 +0000, Andrew Haley wrote:
>> "An object shall have its stored value accessed only by an lvalue
>> expression that has one of the following types:
>>
>> but
>>
>> (union u*)&i
>>
>> is not a legal lvalue expression because the dereference is undefined
>> behaviour. You may only dereference a pointer as permitted by 6.3.2.3.
>
> For the same reason, (char *) &i could not be dereferenced, and this
> would break a lot of code!
Try reading it. This is Clause 7.
Andrew.