Linux and aliasing?
Tim Hollebeek
tim@wfn-shop.princeton.edu
Fri Jun 4 08:39:00 GMT 1999
Linus Torvalds writes ...
>
> But it should be reasonably easy to implement very straightforward rules,
> and have the rules themselves make common sense ;)
>
> The extremely straightforward rule that at least I would advocate is _so_
> straightforward as to be almost scary:
> - if there is a pointer cast, that pointer cast invalidates all
> type-based alias information.
I think it's pretty obvious this is the wrong thing to do.
Sure, it does the right thing (for a narrow definition of "right
thing") if your code always uses hairy expressions where all the
nastiness is jumbled in one expression.
If you do the same type tricks but use intermediate variables to
improve readability, you lose. In fact, simply taking an expression
and decomposing it into constituent parts can change the behavior of
code under this rule. Absolutely horrible.
Unless you're suggesting data flow analysis to figure out which
pointers values could have been derived from a casted pointer??? ick,
ick, ick.
-Tim
More information about the Gcc
mailing list