public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Sai-Lai Lo <s.lo@uk.research.att.com>
To: gcc-gnats@gcc.gnu.org
Subject: c++/3290: SEGV in the ctor of a complex multiple inherited class
Date: Wed, 20 Jun 2001 06:46:00 -0000	[thread overview]
Message-ID: <200106201341.OAA21499@neem.uk.research.att.com> (raw)

>Number:         3290
>Category:       c++
>Synopsis:       SEGV in the ctor of a complex multiple inherited C++ class
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 20 06:46:03 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Sai Lai Lo
>Release:        3.0
>Organization:
AT&T Laboratories- Cambridge
>Environment:
System: Linux neem.uk.research.att.com 2.4.3patched #3 SMP Tue Apr 3 16:32:03 BST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/usr/local/gcc --enable-threads=posix --enable-languages=c++
>Description:
>How-To-Repeat:
The following simple test code can reproduce the problem:

// compile and run, output as follows
// % ./t
// C_5
// B_5
// B_4
// D_4
// A_3
// C_4
// A_4
// B_3
// C_3
// zsh: segmentation fault (core dumped)  ./t

#include <iostream.h>

class C_5 {
public:
  C_5() {
    cerr << "C_5" << endl;
  }
};

class B_5 : public virtual C_5 {
public:
  B_5() {
    cerr << "B_5" << endl;
  }
};


class C_4 {
public:
  C_4() {
    cerr << "C_4" << endl;
  }
};

class B_4 : public virtual B_5 {
public:
  B_4() {
    cerr << "B_4" << endl;
  }
};

class A_4 : public virtual C_4,
	    public virtual B_5 {
public:
  A_4() {
    cerr << "A_4" << endl;
  }
};

class D_4 : public virtual C_5 {
public:
  D_4() {
    cerr << "D_4" << endl;
  }
};

class A_3 : public virtual B_4,
            public virtual D_4 {
public:
  A_3() {
    cerr << "A_3" << endl;
  }
};

class B_3 : public virtual A_4,
          public virtual B_4 {
public:
  B_3() {
    cerr << "B_3" << endl;
  }
};



class C_3 : public virtual C_4,
          public virtual D_4 {
public:
  C_3() {
    cerr << "C_3" << endl;
  }
};

class A_2 : public virtual A_3,
          public virtual B_3,
          public virtual C_3 {
public:
  A_2() {
    cerr << "A_2" << endl;
  }
};

class A_1 : public virtual A_2 {
public:
  A_1() {
    cerr << "A_1" << endl;
  }
};

int
main(int, char**) {
  A_1 a1;
  return 0;
}



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


                 reply	other threads:[~2001-06-20  6:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200106201341.OAA21499@neem.uk.research.att.com \
    --to=s.lo@uk.research.att.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).