Bug 10506 - [3.3/3.4 regression] ICE in build_new at cp/init.c with -fkeep-inline-functions and multiple inheritance
Summary: [3.3/3.4 regression] ICE in build_new at cp/init.c with -fkeep-inline-functio...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2.2
: P3 normal
Target Milestone: 3.3
Assignee: Mark Mitchell
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-04-25 21:56 UTC by b4hand
Modified: 2004-07-13 17:43 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gcc-32-crash.ii.bz2 (29.17 KB, application/octet-stream)
2003-05-21 15:17 UTC, b4hand
Details

Note You need to log in before you can comment on or make changes to this bug.
Description b4hand 2003-04-25 21:56:01 UTC
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 4 Mark Mitchell 2003-04-28 06:06:59 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10506
Date: 28 Apr 2003 06:06:59 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-04-28 06:06:59
 
 Modified files:
 	gcc/cp         : ChangeLog method.c cp-tree.h class.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/init: new6.C ref6.C 
 
 Log message:
 	PR c++/10506
 	* method.c (use_thunk): Decrement immediate_size_expand.
 	
 	PR c++/10503
 	* cp-tree.h (DECL_VAR_MARKED_P): New macro.
 	(DECL_MAYBE_TEMPLATE): Remove.
 	* class.c (fixed_type_or_null): Avoid infinite recursion.
 	
 	PR c++/10506
 	* g++.dg/init/new6.C: New test.
 	
 	PR c++/10503
 	* g++.dg/init/ref6.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3344&r2=1.3345
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&r1=1.246&r2=1.247
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.839&r2=1.840
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.533&r2=1.534
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2626&r2=1.2627
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ref6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 5 Mark Mitchell 2003-04-28 06:06:59 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10506
Date: 28 Apr 2003 06:06:59 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-04-28 06:06:59
 
 Modified files:
 	gcc/cp         : ChangeLog method.c cp-tree.h class.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/init: new6.C ref6.C 
 
 Log message:
 	PR c++/10506
 	* method.c (use_thunk): Decrement immediate_size_expand.
 	
 	PR c++/10503
 	* cp-tree.h (DECL_VAR_MARKED_P): New macro.
 	(DECL_MAYBE_TEMPLATE): Remove.
 	* class.c (fixed_type_or_null): Avoid infinite recursion.
 	
 	PR c++/10506
 	* g++.dg/init/new6.C: New test.
 	
 	PR c++/10503
 	* g++.dg/init/ref6.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3344&r2=1.3345
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&r1=1.246&r2=1.247
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.839&r2=1.840
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.533&r2=1.534
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2626&r2=1.2627
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ref6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 6 Mark Mitchell 2003-04-28 06:09:51 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10506
Date: 28 Apr 2003 06:09:51 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	mmitchel@gcc.gnu.org	2003-04-28 06:09:51
 
 Modified files:
 	gcc/cp         : ChangeLog method.c cp-tree.h class.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/init: new6.C ref6.C 
 
 Log message:
 	PR c++/10506
 	* method.c (use_thunk): Decrement immediate_size_expand.
 	
 	PR c++/10503
 	* cp-tree.h (DECL_VAR_MARKED_P): New macro.
 	(DECL_MAYBE_TEMPLATE): Remove.
 	* class.c (fixed_type_or_null): Avoid infinite recursion.
 	
 	PR c++/10506
 	* g++.dg/init/new6.C: New test.
 	
 	PR c++/10503
 	* g++.dg/init/ref6.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.117&r2=1.3076.2.118
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.237.4.1&r2=1.237.4.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.776.2.16&r2=1.776.2.17
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.499.2.11&r2=1.499.2.12
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.156&r2=1.2261.2.157
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ref6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 

Comment 7 Mark Mitchell 2003-04-28 06:09:51 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10506
Date: 28 Apr 2003 06:09:51 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	mmitchel@gcc.gnu.org	2003-04-28 06:09:51
 
 Modified files:
 	gcc/cp         : ChangeLog method.c cp-tree.h class.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/init: new6.C ref6.C 
 
 Log message:
 	PR c++/10506
 	* method.c (use_thunk): Decrement immediate_size_expand.
 	
 	PR c++/10503
 	* cp-tree.h (DECL_VAR_MARKED_P): New macro.
 	(DECL_MAYBE_TEMPLATE): Remove.
 	* class.c (fixed_type_or_null): Avoid infinite recursion.
 	
 	PR c++/10506
 	* g++.dg/init/new6.C: New test.
 	
 	PR c++/10503
 	* g++.dg/init/ref6.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.117&r2=1.3076.2.118
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.237.4.1&r2=1.237.4.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.776.2.16&r2=1.776.2.17
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.499.2.11&r2=1.499.2.12
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.156&r2=1.2261.2.157
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ref6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
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.
Comment 9 GCC Commits 2004-02-28 11:24:11 UTC
Subject: Bug 10506

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_2-rhl8-branch
Changes by:	jakub@gcc.gnu.org	2004-02-28 11:24:05

Modified files:
	gcc/cp         : ChangeLog 
	gcc/testsuite  : ChangeLog 
	gcc/cp         : class.c method.c cp-tree.h 
Added files:
	gcc/testsuite/g++.dg/init: ref6.C new6.C 

Log message:
	2003-04-27  Mark Mitchell  <mark@codesourcery.com>
	
	PR c++/10506
	* method.c (use_thunk): Decrement immediate_size_expand.
	
	PR c++/10503
	* cp-tree.h (DECL_VAR_MARKED_P): New macro.
	(DECL_MAYBE_TEMPLATE): Remove.
	* class.c (fixed_type_or_null): Avoid infinite recursion.
	
	PR c++/10506
	* g++.dg/init/new6.C: New test.
	
	PR c++/10503
	* g++.dg/init/ref6.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.2685.2.114.2.8.2.27&r2=1.2685.2.114.2.8.2.28
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.1672.2.166.2.8.2.78&r2=1.1672.2.166.2.8.2.79
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.436.2.10.2.4.2.6&r2=1.436.2.10.2.4.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.219.2.4.8.2&r2=1.219.2.4.8.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.681.2.12.2.3.2.8&r2=1.681.2.12.2.3.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ref6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=NONE&r2=1.1.32.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=NONE&r2=1.1.32.1