This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
bug with -O2 in g++ Debian 4.0.2-9 ?
- From: Jerome Robert <jeromerobert at users dot sourceforge dot net>
- To: gcc-help at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Thu, 23 Feb 2006 10:56:46 +0100
- Subject: bug with -O2 in g++ Debian 4.0.2-9 ?
Here is the faulty program (this kind of code is generated by
http://www.swig.org):
/////////// Start ///////////
#include <stdio.h>
int main(void)
{
long long a = 0x77777777L;
long long b = 0;
void ** aa=(void **)(void *)&a;
void ** ab=(void **)(void *)&b;
*ab = *aa;
printf("in: %llX, out: %llX\n", a, b);
return 0;
}
/////////// End ///////////
The output for the following version is:
(Debian 1:3.3.6-12) g++ in: 77777777, out: 77777777
(Debian 1:3.3.6-12) g++ -O1 in: 77777777, out: 77777777
(Debian 1:3.3.6-12) g++ -O2 in: 77777777, out: 77777777
(Debian 4.0.2-9) g++ in: 77777777, out: 77777777
(Debian 4.0.2-9) g++ -O1 in: 77777777, out: 77777777
(Debian 4.0.2-9) g++ -O2 in: 77777777, out: 0
So there is something wrong with g++ -O2 (Debian 4.0.2-9). Is this program wrong
or is this a bug ?
Regards,
Jerome