This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: bug with -O2 in g++ Debian 4.0.2-9 ?
- From: Andrew Haley <aph at redhat dot com>
- To: Jerome Robert <jeromerobert at users dot sourceforge dot net>
- Cc: gcc-help at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Thu, 23 Feb 2006 10:12:54 +0000
- Subject: Re: bug with -O2 in g++ Debian 4.0.2-9 ?
- References: <1140688606.43fd86de63f58@imp6-g19.free.fr>
Jerome Robert writes:
> Is this program wrong
Yes.
See ISO C9899:199 Section 6.3.2.3.
These lines are particularly bogus:
void ** aa=(void **)(void *)&a;
void ** ab=(void **)(void *)&b;
All the cast to (void *) does is suppress a useful warning.
-fno-strict-aliasing may help.
Andrew.