c++/1864: another problem with virtual derivation
snyder@fnal.gov
snyder@fnal.gov
Sat Feb 3 14:46:00 GMT 2001
>Number: 1864
>Category: c++
>Synopsis: critical
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Sat Feb 03 14:46:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: scott snyder
>Release: 2.97 20010129 (experimental)
>Organization:
>Environment:
System: Linux karma 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix
>Description:
When the program below is compiled and run, it crashes:
$ g++ -g -o xidl xidl.cpp
$ ./xidl
Segmentation fault (core dumped)
$
Here's the stack trace where it crashes:
Program received signal SIGSEGV, Segmentation fault.
0x8048bd2 in _ZN20CORBA_Container_implC2EPPKv (this=0x8050ec8,
__vtt_parm=0x804a0d8) at xidl.cpp:16
16 new CORBA_Repository_impl();
(gdb) where
#0 0x8048bd2 in _ZN20CORBA_Container_implC2EPPKv (this=0x8050ec8,
__vtt_parm=0x804a0d8) at xidl.cpp:16
#1 0x8048786 in _ZN21CORBA_Repository_implC1Ev (this=0x8050eb8) at xidl.cpp:16
#2 0x80486b1 in main () at xidl.cpp:16
#3 0x400edfd1 in __libc_start_main (main=0x8048690 <main>, argc=1,
ubp_av=0xbfffd854, init=0x80484e8 <_init>, fini=0x8049014 <_fini>,
rtld_fini=0x4000e254 <_dl_fini>, stack_end=0xbfffd84c)
at ../sysdeps/generic/libc-start.c:118
>How-To-Repeat:
This one's even from a real program (the orbacus idl compiler),
rather than a contrived test case :).
-----------------------------------------------------
class OBRefCount
{
public:
int ref_;
virtual ~OBRefCount() {}
};
class CORBA_Container_skel : virtual public OBRefCount {};
class CORBA_Container_impl : public virtual CORBA_Container_skel {};
class CORBA_Repository_impl : public virtual CORBA_Container_skel,
public virtual CORBA_Container_impl {};
int main()
{
new CORBA_Repository_impl();
return 0;
}
-----------------------------------------------------
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list