[Bug c++/17765] New: optimizer generates wrong code for inlined function
p dot van-hoof at qub dot ac dot uk
gcc-bugzilla@gcc.gnu.org
Fri Oct 1 02:33:00 GMT 2004
When the attached test case is compiled without optimization, it produces the
folowing output:
dogbert> g++ -O0 f.cc
dogbert> a.out
1
With optimization turned on, it produces this:
dogbert> g++ -O2 f.cc
dogbert> a.out
0
A minimum of -O2 is needed. This problem occurs with all release versions of the
3.3 and 3.4 branch, as well as the mainline (version 20040908). Actually the
mainline crashes on a segfault for all levels of optimization (including -O0) on
the IA32 platform, but shows the behavior shown above on the AMD64 platform. A
slightly modified version of the code (to account for the fact that this is a
big-endian platform) can also reproduce the same problem on a Sparc platform for
the 3.3 and 3.4 branch; the status of the mainline on Sparc is currently
unknown. Apparantly this problem is platform independent. The 3.2.3 version of
the code behaves correctly on all mentioned platforms, hence this appears to be
a regression.
--
Summary: optimizer generates wrong code for inlined function
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: p dot van-hoof at qub dot ac dot uk
CC: gcc-bugs at gcc dot gnu dot org
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=17765
More information about the Gcc-bugs
mailing list