This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

c++/3006: bad code for complicated virtual inheritance (regression from 2.95)



>Number:         3006
>Category:       c++
>Synopsis:       bad code for complicated virtual inheritance (regression from 2.95)
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed May 30 13:36:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        3.0 20010529 (prerelease)
>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 --enable-long-long
>Description:

When the program below is compiled with gcc 3, it crashes with a SEGV
when run.  When compiled with gcc 2.95, it executes normally.

>How-To-Repeat:

-----------------------------------------------------
struct CORBA_Object
{
  virtual ~CORBA_Object() {}
};

class CORBA_Object_skel    : public virtual CORBA_Object {};
class CORBA_IRObject_skel  : virtual public CORBA_Object_skel {};
class CORBA_Container_skel : virtual public CORBA_IRObject_skel {};
class CORBA_IRObject_impl  : public virtual CORBA_IRObject_skel {};

class CORBA_Repository_impl
  : public virtual CORBA_Container_skel,
    public virtual CORBA_IRObject_impl
{
};


int
main(int argc, char* argv[])
{
  new CORBA_Repository_impl;
  return 0;
}
-----------------------------------------------------

[sss@karma translator]$ g++ -g -o xidl xidl.cpp
[sss@karma translator]$ ./xidl
Segmentation fault (core dumped)

Here's the stack trace where it crashed:


#0  0x804990d in _ZN19CORBA_IRObject_implC2Ev (this=0x804b62c, 
    __vtt_parm=0x804ae3c) at xidl.cpp:21
#1  0x80488c8 in _ZN21CORBA_Repository_implC1Ev (__vtt_parm=0x804b628)
    at xidl.cpp:21
#2  0x80487c1 in main (argc=1, argv=0xbfffd3b4) at xidl.cpp:21
(gdb) x/i $pc
0x804990d <_ZN19CORBA_IRObject_implC2Ev+109>:   mov    (%edx),%edx
(gdb) p/x $edx
$1 = 0x10094048
(gdb) x/x 0x10094048
0x10094048:     Cannot access memory at address 0x10094048



>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]