From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32408 invoked by alias); 4 Jan 2002 02:46:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 32374 invoked by uid 71); 4 Jan 2002 02:46:02 -0000 Resent-Date: 4 Jan 2002 02:46:02 -0000 Resent-Message-ID: <20020104024602.32372.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, daniel.elstner@gmx.net Received:(qmail 31655 invoked by uid 61); 4 Jan 2002 02:43:51 -0000 Message-Id:<20020104024351.31654.qmail@sources.redhat.com> Date: Thu, 03 Jan 2002 18:46:00 -0000 From: daniel.elstner@gmx.net Reply-To: daniel.elstner@gmx.net To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/5270: MI + virtual base: segfault when throwing an exception in a derived ctor X-SW-Source: 2002-01/txt/msg00136.txt.bz2 List-Id: >Number: 5270 >Category: c++ >Synopsis: MI + virtual base: segfault when throwing an exception in a derived ctor >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Thu Jan 03 18:46:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Daniel Elstner >Release: gcc version 3.0.4 20020103 (prerelease) >Organization: >Environment: i686-pc-linux-gnu >Description: Scenario: A particular inheritance construct involving MI and one virtual base class (for further details please look at the test case). When the ctor of the most-derived class throws an exception, the program receives a SIGSEGV. The problem seems to occur only if both base classes, the virtual and the non-virtual one, have a virtual dtor. I was also able to reproduce (the closed) PR #2276, which seems to be the same issue. The segfault is reproduceable with gcc releases 3.0.2, 3.0.3, and CVS 3.0.4 20020103. It works fine with 2.95.4 20010319 and RedHat's 2.96 (don't know the exact revision). >How-To-Repeat: g++ -o test-ctor-throw test-ctor-throw.cc ./test-ctor-throw It should print "exception caught: foobar" if it works. Using the gcc versions mentioned in the PR description, it receives a segmentation fault. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="test-ctor-throw.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test-ctor-throw.cc" CiNpbmNsdWRlIDxjc3RkaW8+CiNpbmNsdWRlIDxzdGRleGNlcHQ+CgoKc3RydWN0IEEKewogIEEo KSAgICAgICAgICB7IHB1dHMoX19QUkVUVFlfRlVOQ1RJT05fXyk7IH0KICB2aXJ0dWFsIH5BKCkg eyBwdXRzKF9fUFJFVFRZX0ZVTkNUSU9OX18pOyB9Cn07CgpzdHJ1Y3QgQgp7CiAgQigpICAgICAg ICAgIHsgcHV0cyhfX1BSRVRUWV9GVU5DVElPTl9fKTsgfQogIHZpcnR1YWwgfkIoKSB7IHB1dHMo X19QUkVUVFlfRlVOQ1RJT05fXyk7IH0KfTsKCnN0cnVjdCBDIDogdmlydHVhbCBwdWJsaWMgQSwg cHVibGljIEIKewogIEMoKSAgICAgICAgICB7IHB1dHMoX19QUkVUVFlfRlVOQ1RJT05fXyk7IH0K ICB2aXJ0dWFsIH5DKCkgeyBwdXRzKF9fUFJFVFRZX0ZVTkNUSU9OX18pOyB9Cn07CgpzdHJ1Y3Qg RCA6IHB1YmxpYyBDCnsKICBEKCkgewogICAgcHV0cyhfX1BSRVRUWV9GVU5DVElPTl9fKTsKICAg IHRocm93IHN0ZDo6cnVudGltZV9lcnJvcigiZm9vYmFyIik7CiAgfQogIHZpcnR1YWwgfkQoKSB7 IHB1dHMoX19QUkVUVFlfRlVOQ1RJT05fXyk7IH0KfTsKCgppbnQgbWFpbihpbnQgYXJnYywgY2hh cioqIGFyZ3YpCnsKICB0cnkKICB7CiAgICBEIGQ7CiAgfQogIGNhdGNoKGNvbnN0IHN0ZDo6ZXhj ZXB0aW9uJiBlKQogIHsKICAgIHByaW50ZigiZXhjZXB0aW9uIGNhdWdodDogJXNcbiIsIGUud2hh dCgpKTsKICB9CgogIHJldHVybiAwOwp9Cgo=