Fwd: Problem report: Struct aliasing problem causes Thread_Ready_Chain corruption in 4.6.99.3

Ralf Corsepius ralf.corsepius at rtems.org
Tue Nov 21 14:24:15 UTC 2006


On Tue, 2006-11-21 at 13:38 +0100, Thomas Doerfler wrote:

> I found a good discussion about GCC and strict aliasing here:
> 
> http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html
> 
> Maybe it would help to modify the definition of Chain_Ctronol to
> something like:
> 
> typedef union {
>   struct {
>     struct Chain_Node_struct head;
>     void *fill_loc1;
>   } head_node;
> 
>   struct {
>     void *fill_loc1;
>     struct Chain_Node_struct tail;
>   } tail_node;
> } Chain_Control;
> 
> The names are NOT good, and surely all chain.c/chain.inl functions would
> have to be adapted but this might be a mechanical search/replace procedure.
> 
> Any comments to a change like this?
Normally, there are easier ways out of such issues. 

Esp. because GCC normally is pretty good at warning about places
exposing this problem (the infamous "punned pointer" warnings). 

But we'd need an actual piece of code exposing this problem. Anything
else is "poking around in the fog"

> I am sure this problem MUST be solved before 4.7 goes out.
ACK.

Ralf





More information about the users mailing list