Bug 8601

Summary: Derived nested classes cause seg fault when trying to display
Product: gdb Reporter: dan.gruhn
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gdb-prs, tromey
Priority: P3    
Version: 6.0   
Target Milestone: 7.1   
Host: Target:
Build: Last reconfirmed:

Description dan.gruhn 2003-12-26 21:18:00 UTC
[Converted from Gnats 1496]

Given the source:

class baseClass
{
public:
	class Component
	{
	public:
		Component() {}
		virtual ~Component(){}
	};
};

class subClass : public baseClass
{
public:
	class Component : public baseClass::Component
	{
	public:
		Component() {}
		void	dummy() {}
	};
};

	int
main(

int	argc,
char *	argv[]
)
{
	subClass::Component *	comp = new subClass::Component();

	comp->dummy();

	return(0);
}

gdb seg faults when trying to display subClass::Component.

Bsh> gdb a.out
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) b 31
Breakpoint 1 at 0x804851e: file main.cc, line 31.
(gdb) run
Starting program: /home/dgruhn/test/a.out 

Breakpoint 1, main (argc=1, argv=0xbfffd594) at main.cc:31
warning: Source file is more recent than executable.

31              comp->dummy();
(gdb) print *comp
Segmentation fault

If virtual destructor of baseClass::Component is removed,
no problem:

Release:
6.0

Environment:
Redhat 9.0 
Linux 2.4.20-27.9smp #1 SMP Thu Dec 11 13:15:04 EST 2003 i686 i686 i386 GNU/Linux
g++ version 3.3.2

How-To-Repeat:
See description
Comment 1 Tom Tromey 2010-02-16 23:41:34 UTC
I think this was recently fixed in cvs.
The test case works fine for me.