[lkml]   [2003]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Is -fno-strict-aliasing still needed?
Horst von Brand wrote:
> Art Haas <> said:
> > I ask because I've just built a kernel without using that flag -
> > linus-2.5 BK from this morning, probably missing the 2.5.60 release by
> > a few hours.
> The problem with strict aliasing is that it allows the compiler to assume
> that in:
> void somefunc(int *foo, int *bar)
> foo and bar will _*never*_ point to the same memory area (at the same
> struct, or into the same array, etc). There is no way to check for this in
> the compiler in general (the function and the call might be in different
> files, many functions are being called via pointers, ...).

I though pointers to the same type, such as int *, could alias still.

But pointers to different types, such as int* and short* is assumed
to never clash with strict aliasing. And this bites linux
because it sometimes choose to see "two adjacent shorts as one int" for
performance reasons.

I remember the flag was introduced because some IP or TCP
code do exactly this, and converting it all to unions would
render that code unreadable.

Helge Hafting
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.047 / U:0.960 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site