This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/4922: gcc-3.0.1 and 3.0.2 generate wrong code with -O2
- From: jakub at gcc dot gnu dot org
- To: er at openoffice dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, mh at openoffice dot org, nobody at gcc dot gnu dot org
- Date: 21 Feb 2002 16:11:13 -0000
- Subject: Re: optimization/4922: gcc-3.0.1 and 3.0.2 generate wrong code with -O2
- Reply-to: jakub at gcc dot gnu dot org, er at openoffice dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, mh at openoffice dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: gcc-3.0.1 and 3.0.2 generate wrong code with -O2
State-Changed-From-To: open->closed
State-Changed-By: jakub
State-Changed-When: Thu Feb 21 08:11:12 2002
State-Changed-Why:
This is not a bug in gcc, but in your code.
Code like:
inline UINT16* RowPos() { return (UINT16*) &nAddress; }
*RowPos() = (UINT16) nRow;
does not obey aliasing rules (the code is accessing
nAddress both as 32-bit integer and 16-bit integer).
Please read info gcc about -fstrict-aliasing.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4922