Bug 11473 - [3.3/3.4 Regression] ICE with -gstabs when empty struct inheits from an empty struct
Summary: [3.3/3.4 Regression] ICE with -gstabs when empty struct inheits from an empty...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: 3.3.1
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 11675 12844 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-09 14:17 UTC by Jack Lloyd
Modified: 2004-01-17 04:22 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-07-13 00:21:43


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jack Lloyd 2003-07-09 14:17:43 UTC
Including virtually any STL header and attempting to compile with -gstabs with
GCC 3.3 causes an ICE on x86/Linux. I'm using glibc 2.2.5 and binutils
2.11.93.0.2, though I doubt either is relevant here. Using other debug flags,
like -gstabs+, -gdwarf, -gdwarf-2, etc, seems to work fine.

$ cat stabsbug.cpp 
#include <vector>

int main() { return 0; }

$ g++-3.3 -gstabs stabsbug.cpp -c -o /dev/null 
In file included from /usr/local/gcc-3.3/include/c++/3.3/bits/stl_algobase.h:73,
                 from /usr/local/gcc-3.3/include/c++/3.3/vector:67,
                 from stabsbug.cpp:1:
/usr/local/gcc-3.3/include/c++/3.3/bits/stl_iterator_base_types.h:84: internal
compiler error: Segmentation
   fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
$ g++-3.3 -v
Reading specs from /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/usr/local/gcc-3.3 --enable-threads
Thread model: posix
gcc version 3.3
Comment 1 Andrew Pinski 2003-07-09 14:26:14 UTC
Confirmed on 3.3.1 (20030707) and the mainline (20030708),
Simplified example:
struct t{};
struct g : public t{};
Comment 2 Wolfgang Bangerth 2003-07-09 14:31:22 UTC
Indeed confirmed with Andrew's small testcase. This is a regression w.r.t.
3.2, where it worked.

A backtrace on mainline looks like this:
#0  host_integerp (t=0x0, pos=0) at ../../gcc/gcc/tree.c:3251
#1  0x08600ca0 in ?? ()
#2  0x083b7cb9 in tree_low_cst (t=0x0, pos=0) at ../../gcc/gcc/tree.c:3270
#3  0x081b7750 in dbxout_type (type=0x403d98dc, full=1)
    at ../../gcc/gcc/dbxout.c:1659
#4  0x081b8ef5 in dbxout_symbol (decl=0x403d9a20, local=0)
    at ../../gcc/gcc/dbxout.c:2124
#5  0x083a8635 in rest_of_type_compilation (type=0x403d98dc, toplev=1077778976)
    at ../../gcc/gcc/toplev.c:2406
#6  0x080cf588 in finish_struct_1 (t=0x1) at ../../gcc/gcc/cp/class.c:5213
#7  0x080d0296 in finish_struct (t=0x403d98dc, attributes=0x0)
    at ../../gcc/gcc/cp/class.c:5271
#8  0x0813dd8a in finish_class_definition (t=0x403d98dc, attributes=0x0, 
    semi=1, pop_scope_p=0) at ../../gcc/gcc/cp/semantics.c:2033

So it's really a problem in the debug backends, rather than the C++ front
end (of course).

W.
Comment 3 Jack Lloyd 2003-07-09 14:33:21 UTC
In that case this is probably a dupe of bug 7083, though it's odd, because that
bug was for GCC 3.1, and I didn't run into this with 3.1 or 3.2. Hrm.


Comment 4 Steven Bosscher 2003-07-12 12:20:35 UTC
The problem is apparently in dbxout.c:dbxout_type:

		print_wide_int (tree_low_cst (DECL_SIZE
					      (TYPE_NAME
					       (BINFO_TYPE (child))),
					      0)
				* BITS_PER_UNIT);

But the tree for DECL_SIZE that is passed is NULL.

Is this really target specific?
Comment 5 Dara Hazeghi 2003-07-13 00:21:43 UTC
Not target specific (occurs on powerpc darwin).
Comment 6 Steven Bosscher 2003-07-14 10:51:22 UTC
: Search converges between 2002-09-29-trunk (#91) and 2002-10-02-trunk (#92).
Comment 8 CVS Commits 2003-07-15 16:56:53 UTC
Subject: Bug 11473

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-07-15 16:56:50

Modified files:
	gcc            : ChangeLog dbxout.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/debug: debug8.C 

Log message:
	PR debug/11473
	* dbxout.c (dbxout_type): Use TYPE_SIZE to determine the sizes of
	base classes.
	
	PR debug/11473
	* g++.dg/debug/debug8.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.515&r2=2.516
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dbxout.c.diff?cvsroot=gcc&r1=1.154&r2=1.155
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2880&r2=1.2881
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/debug/debug8.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 9 Mark Mitchell 2003-07-15 17:00:00 UTC
Fixed in GCC 3.3.1, GCC 3.4.
Comment 10 Mark Mitchell 2003-07-15 17:00:19 UTC
Fixed in GCC 3.3.1, GCC 3.4.
Comment 11 Andrew Pinski 2003-07-25 15:07:43 UTC
*** Bug 11675 has been marked as a duplicate of this bug. ***
Comment 12 Andrew Pinski 2003-10-30 17:31:39 UTC
*** Bug 12844 has been marked as a duplicate of this bug. ***