This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wstrict-aliasing in 2.95/6?
>>>>> "Jamie" == Jamie Lokier <egcs@tantalophile.demon.co.uk> writes:
Jamie> Dave Miller gave this:
[stuff about TCP hash comparisons in the Linux kernel]
Jamie> Apparently this occurs a lot in the kernel.
[...]
Jamie> That one falls out naturally: dereferencing char * can alias
Jamie> anything.
If there were an option to change that rule to allow ANY integral type
pointer to alias all memory, would that fix the problem? (It does for
the examples mentioned so far...)
It seems that the "char *" exception was designed for people munging
memory directly, but in these days of alignment-sensitive access
times, people want to use wider types than char for high-performance
hashes, memcpys, etc. Do all (or most of) the hard-to-fix cases in
the Linux kernel fall into this category?
- Pat