Linux and aliasing?

Jamie Lokier egcs@tantalophile.demon.co.uk
Wed Jun 30 15:43:00 GMT 1999


Tim Hollebeek wrote:
> This is going to happen even with the Torvalds hack.  If they are
> writing code that ignores the aliasing rules, not every single
> instance will conform to the Torvalds "all pointer trickery happens in
> a single expression" coding style.  Hence their binary will still fail.
> 
> Then we'll have to explain two things to them instead of just one: the
> ANSI rules, and the extra Torvalds non-ANSI rules.

Which is why we should make the compiler emit a warning for anything
that _looks_ like it might break because of the aliasing rules.

This will include some conforming code.  Such is life.  It can be
disabled case by case -- just as you can write `if ((x & 1))' or `int
x __attribute__ ((unused))' to disable some other useful warnings.

My proposal for a type attribute handles this quite generally -- no
Torvalds style required.

have a nice day,
-- Jamie



More information about the Gcc mailing list