This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/1496: Derived nested classes cause seg fault when trying to display


>Number:         1496
>Category:       c++
>Synopsis:       Derived nested classes cause seg fault when trying to display
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 26 21:18:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Daniel Gruhn
>Release:        6.0
>Organization:
>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
>Description:
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:
>How-To-Repeat:
See description
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]