10506 – [3.3/3.4 regression] ICE in build_new at cp/init.c with -fkeep-inline-functions and multiple inheritance (original) (raw)
I tried to trim this code down as much as possible. I've attached the preprocessed output. Moving the "new" statement into the initializers seems to prevent the ICE. Removing -fkeep-inline-functions also prevents the ICE, as well as not deriving Foo from QGroupBox. I hope these details help. This ICE also shows up when using the gcc-3_3-branch. The following is the original source code and the output from g++:
#include <qgroupbox.h>
class Foo : public QGroupBox { public: Foo (); virtual ~Foo ();
private: int *mInt; };
Foo::Foo () : QGroupBox (0, 0), mInt (0) { mInt = new int; }
Foo::~Foo () { delete mInt; }
/usr/local/bin/g++-3 -v -save-temps gcc-32-crash.cc -o gcc-32-crash.o -c -fkeep-inline-functions -I/usr/lib/qt2/include Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/specs Configured with: ./configure --enable-threads Thread model: posix gcc version 3.2.2 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -I/usr/lib/qt2/include -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ gcc-32-crash.cc gcc-32-crash.ii GNU CPP version 3.2.2 (cpplib) (i386 Linux/ELF) ignoring nonexistent directory "NONE/include" ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/qt2/include /usr/local/include/c++/3.2.2 /usr/local/include/c++/3.2.2/i686-pc-linux-gnu /usr/local/include/c++/3.2.2/backward /usr/local/include /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include /usr/include End of search list. /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/cc1plus -fpreprocessed gcc-32-crash.ii -quiet -dumpbase gcc-32-crash.cc -version -fkeep-inline-functions -o gcc-32-crash.s GNU CPP version 3.2.2 (cpplib) (i386 Linux/ELF) GNU C++ version 3.2.2 (i686-pc-linux-gnu) compiled by GNU C version 2.95.2 19991024 (release). gcc-32-crash.cc: In constructor `Foo::Foo()': gcc-32-crash.cc:17: Internal compiler error in build_new, at cp/init.c:1975
Release: gcc-3.2.2
Environment: i686-pc-linux-gnu; Kernel 2.4.6; SuSE 7.1
How-To-Repeat: Compile the attached preprocessed file with the following command:
g++ gcc-32-crash.ii -c -o gcc-32-crash.o -fkeep-inline-functions
Comment 2 Wolfgang Bangerth 2003-04-25 22:35:50 UTC
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed: ------------------------- struct B1 { virtual ~B1(); }; struct B2 { virtual ~B2(); }; struct D : B1, B2 {}; struct X : D { X (); };
X::X () { new int; }
---------------------------
This fails with 3.2, 3.3 and 3.4:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c y.cc -fkeep-inline-functions
y.cc: In constructor `X::X()':
y.cc:6: internal compiler error: in build_new, at cp/init.c:1925
It doesn't ICE in 3.0, so is a regression
W.Comment 3 Mark Mitchell 2003-04-27 20:03:48 UTC
Responsible-Changed-From-To: unassigned->mmitchel Responsible-Changed-Why: Working on a fix.
Comment 8 Mark Mitchell 2003-04-28 06:11:43 UTC
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed in GCC 3.3, GCC 3.4.