lkml.org 
[lkml]   [2003]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Is -fno-strict-aliasing still needed?
Horst von Brand wrote:
>
> Art Haas <ahaas@airmail.net> 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

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