This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14024] g++ isn't reporting aliasing warnings
- From: "uros at kss-loka dot si" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Dec 2004 07:49:23 -0000
- Subject: [Bug c++/14024] g++ isn't reporting aliasing warnings
- References: <20040205044820.14024.tjw@omnigroup.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From uros at kss-loka dot si 2004-12-29 07:49 -------
This example is from PR 16111:
#include <stdio.h>
float foo ()
{
unsigned int MASK = 0x80000000;
return (float &) MASK;
}
int main() {
printf ("%f\n", foo());
return 0;
}
'g++ -Wstrict-aliasing' does not generate a warning about breaking
strict-aliasing rules. When '(float&)MASK' is replaced with equivalent '*(float
*)&MASK', 'gcc -Wstrict-aliasing' produces expected warning.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |djp at volny dot cz
GCC build triplet|powerpc-apple-darwin7.2.0 |*-*-*
GCC host triplet|powerpc-apple-darwin7.2.0 |*-*-*
GCC target triplet|powerpc*-*-* |*-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14024