f/sta.c:340: warning: dereferencing type-punned pointer will break strict-aliasing rules

Michael Matz matz@suse.de
Tue Nov 26 08:22:00 GMT 2002


Hi,

On 25 Nov 2002, Gabriel Dos Reis wrote:

> Right, the warning is really silly in that case.  Maybe the
> type-punning detection machinery should be mabe aware of that rule..
> But as you I'm not a big fan of that warning in the first place so it

I just wanted to say that for our package maintainers this warning _is_
usefull.  They found already some real problems.  But indeed it has too
many obvious false positives like poor-mans derived-to-base conversions,
which happen quite a lot in some packages (wine for instance due to the
err, funny win32 object-oriented-C API).

> will probably end up with low priority in my bucket.

I have no idea about frontends, is there a function which already does a
prefix test on structs?

Hmm, now thinking about this: is the use of prefixes really aliasing safe,
or is that just an gcc extension?  After all, the structs _are_ different
types with no releation.  (Even if it's a gcc extension we don't want to
warn of course)


Ciao,
Michael.



More information about the Gcc mailing list