From: Helge Hafting <helgehaf@aitel.hist.no>
To: Horst von Brand <brand@jupiter.cs.uni-dortmund.de>
Cc: linux-kernel@vger.kernel.org, Art Haas <ahaas@airmail.net>
Subject: Re: Is -fno-strict-aliasing still needed?
Date: Tue, 11 Feb 2003 11:24:38 +0100 [thread overview]
Message-ID: <3E48CF66.DC8B7F13@aitel.hist.no> (raw)
In-Reply-To: 200302110714.h1B7EA3A006209@eeyore.valparaiso.cl
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
next prev parent reply other threads:[~2003-02-11 10:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-10 20:04 Is -fno-strict-aliasing still needed? Art Haas
2003-02-11 7:14 ` Horst von Brand
2003-02-11 9:12 ` Andreas Schwab
2003-02-11 9:39 ` Horst von Brand
2003-02-11 9:45 ` Andreas Schwab
2003-02-11 10:24 ` Helge Hafting [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-02-11 19:52 Albert Cahalan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E48CF66.DC8B7F13@aitel.hist.no \
--to=helgehaf@aitel.hist.no \
--cc=ahaas@airmail.net \
--cc=brand@jupiter.cs.uni-dortmund.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox