Re: Is -fno-strict-aliasing still needed?

Andreas Schwab (schwab@suse.de)
Tue, 11 Feb 2003 10:45:19 +0100


Horst von Brand <brand@jupiter.cs.uni-dortmund.de> writes:

|> Andreas Schwab <schwab@suse.de> said:
|> > Horst von Brand <brand@jupiter.cs.uni-dortmund.de> writes:
|> >
|> > |> 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
|> >
|> > This is wrong. Only if they are declared restrict.
|>
|> ... can they point to the same area. That is exactly the problem: If you do
|> nothing, the language definition assumes the programmer made sure (LOL!)
|> that they don't point the same way.

Why are you insisting on spreading misinformation?

Pointers that are _not_ declared as restricted can alias _any_ other
non-restricted pointer of the same target type.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
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/