This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/26663] New: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6)
- From: "steffen dot zimmermann at philips dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Mar 2006 13:11:43 -0000
- Subject: [Bug rtl-optimization/26663] New: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or gcc-3.3.6)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The attached C++ code converts a floating point number from
our internal representation to IEEE format.
When run, the program should print a value of 144. This works
with gcc-3.3.6 at any optimization level (-O1 -- -O3). With
gcc-3.4.x and optimization level -O2 or -O3, it prints 42 instead.
I.e., it seems the "iFloat" variable in CMdilFloat::AsFloat() is
never modified.
Here's the output of the code with various vanilla gcc's, along
with their configuration:
$ uname -a
Linux xxx.xxx.com 2.6.9-22.0.2.ELsmp #1 SMP Thu Jan 5 17:13:01 EST 2006 i686
i686 i386 GNU/Linux
$ gcc-3.3.6/bin/g++ -v
Reading specs from
/home/steffenz/gcc/install/gcc-3.3.6/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/specs
Configured with: ../gcc-3.3.6/configure
--prefix=/home/steffenz/gcc/install/gcc-3.3.6 --disable-nls
--enable-languages=c,c++
Thread model: posix
gcc version 3.3.6
$ gcc-3.3.6/bin/g++ -O1 -o test test.cpp && ./test
144
$ gcc-3.3.6/bin/g++ -O2 -o test test.cpp && ./test
144
$ gcc-3.3.6/bin/g++ -O3 -o test test.cpp && ./test
144
$ gcc-3.4.0/bin/g++ -v
Reading specs from
/home/steffenz/gcc/install/gcc-3.4.0/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../gcc-3.4.0/configure
--prefix=/home/steffenz/gcc/install/gcc-3.4.0 --disable-nls
--enable-languages=c,c++
Thread model: posix
gcc version 3.4.0
$ gcc-3.4.0/bin/g++ -O1 -o test test.cpp && ./test
144
$ gcc-3.4.0/bin/g++ -O2 -o test test.cpp && ./test
42
$ gcc-3.4.0/bin/g++ -O3 -o test test.cpp && ./test
42
$ gcc-3.4.6/bin/g++ -v
Reading specs from
/home/steffenz/gcc/install/gcc-3.4.6/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
Configured with: ../gcc-3.4.6/configure
--prefix=/home/steffenz/gcc/install/gcc-3.4.6 --disable-nls
--enable-languages=c,c++
Thread model: posix
gcc version 3.4.6
$ gcc-3.4.6/bin/g++ -O1 -o test test.cpp && ./test
144
$ gcc-3.4.6/bin/g++ -O2 -o test test.cpp && ./test
42
$ gcc-3.4.6/bin/g++ -O3 -o test test.cpp && ./test
42
--
Summary: Wrong generated code with gcc-3.4.x -O2 (ok with -O1 or
gcc-3.3.6)
Product: gcc
Version: 3.4.6
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steffen dot zimmermann at philips dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26663