Problem report: Struct aliasing problem causes Thread_Ready_Chain corruption in 4.6.99.3

Till Straumann strauman at slac.stanford.edu
Wed Nov 22 04:40:03 UTC 2006


Ralf Corsepius wrote:
> On Tue, 2006-11-21 at 15:50 -0800, Till Straumann wrote:
>   
>> FYI
>>
>> linux (2.6.18) is built with -fno-strict-aliasing
>>     
> Well, the Linux kernel has long record of clashing with GCC, rsp. GCC
> having broken  "unclear spots" inside of Linux.
>
>   
>>  and I believe that's what we
>> should do. It is extremely hard to find all problematic cases of aliasing
>> and as someone pointed out, as gcc gets smarter we'll run into more
>> problems.
>>     
> We can't avoid having to identify and fixing all those spots and
> therefore MUST NOT use -fno-strict-aliasing. In fact, a long series of
> changes having gone into rtems > 4.6 actually originates from this
> background.
>   
All I can say is that 'apparent fixes' like intermediate (void*)
casting or intermediate variables don't fix this (but make
the compiler warnings go away).

T.
>   
>> Look e.g., at networking code where a checksum of a header is computed.
>> Type-punning is pretty common in these situations and I wouldn't trust
>> old BSD code to be written with strict aliasing in mind.
>>     
> Right, "punned pointers" need to be taken seriously and need to be
> looked after, but I am more concerned about some very basic RTEMS
> internal structs, such as the "Chain" and the "Object" code.
>
> Ralf
>
>
>   




More information about the users mailing list