RFH: aliasing problems

Sergei Organov osv at javad.com
Wed Dec 13 09:53:55 UTC 2006


Thomas Doerfler writes:

> Sergei,
>
> Sergei Organov schrieb:
>> 
>> IMHO, the only practical fix for the networking code is disabling strict
>> aliasing in compiler by means of -fno-strict-aliasing. I'm afraid that
>> the amount of changes required to make the networking code to be
>> aliasing-clean is too high to be practical.
>
> There may be a different solution, as Peer Stritzinger has stated
> earlier: The GCC-specific keyword "may_alias" can be used to mark any
> data srtuctures, that may break the aliasing rules when accessed.

Yeah, you are right, -- I just forgot about that. Though it still
won't make the code C99-compliant, it is probably a better idea than
turning off strict-aliasing altogether. However, provided GCC warnings
are unreliable, we may still miss some important places :(

Anyway, it's definitely much better idea than putting random pointer
conversions into the source to silence compiler warnings ;)

-- Sergei.




More information about the users mailing list