[Bug rtl-optimization/18806] generate wrong code with hi optimization

dberlin at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 3 13:47:00 GMT 2004


------- Additional Comments From dberlin at gcc dot gnu dot org  2004-12-03 13:47 -------
Actually, this is related to the aliasing stuff described in the non-bugs.

If you look, in the first instance,  you are casting a structure to an unsigned
short *, and treating it like an array.

In fact, i get
structa.c: In function `main':
structa.c:46: warning: passing arg 1 of `in_chksum_tcp' from incompatible
pointer type

This is not legal code.

The second invocation, where you pass p.a, is correct, and we give you correct
code as a result.

If you compile the file with -fno-strict-aliasing, you also get the result you
want, since we ignore the fact that you are violating the aliasing rules.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18806



More information about the Gcc-bugs mailing list