Problem report: Struct aliasing problem causes Thread_Ready_Chain corruption in 4.6.99.3

Sergei Organov osv at javad.com
Sat Dec 9 08:17:52 UTC 2006


Till Straumann
<strauman at slac.stanford.edu> writes:

> Sergei Organov wrote:
>> Till Straumann
>> <strauman at slac.stanford.edu> writes:
>>
>> [...]
>>
>>   
>>> Plus, it seems that there is a gcc (extension?) so that
>>>     
>>
>> I think this is pretty standard-conforming, see below.
>>
>>   

[...]

>> As far as I understand, "alias" is symmetric with respect to read/write.
>> So, provided the standard says int* and char* may alias,
>
> It doesn't. It says that an object may only be accessed by
> an lvalue of compatible type or character type.
>
> -> char[4] is a char array
> -> *(int*)char is an int
>
> The standard doesn't allow a char array to be accessed as an int.

Yes, you are right here indeed. According to the standard char* may
alias anything but not vice versa. Me stands corrected.

-- Sergei.




More information about the users mailing list