This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/18806] generate wrong code with hi optimization
- From: "dberlin at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Dec 2004 13:47:15 -0000
- Subject: [Bug rtl-optimization/18806] generate wrong code with hi optimization
- References: <20041203110655.18806.paolo.abeni@tilab.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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