public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5270: MI + virtual base: segfault when throwing an exception in a derived ctor
@ 2002-03-24 14:55 rodrigc
  0 siblings, 0 replies; 2+ messages in thread
From: rodrigc @ 2002-03-24 14:55 UTC (permalink / raw)
  To: daniel.elstner, gcc-bugs, gcc-prs, nobody

Synopsis: MI + virtual base: segfault when throwing an exception in a derived ctor

State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Sun Mar 24 14:55:30 2002
State-Changed-Why:
    Problem reproduced with gcc 3.0.4.
    
    Problem does not occur with gcc 3.1 20020322 (prerelease)

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5270


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/5270: MI + virtual base: segfault when throwing an exception in a derived ctor
@ 2002-01-03 18:46 daniel.elstner
  0 siblings, 0 replies; 2+ messages in thread
From: daniel.elstner @ 2002-01-03 18:46 UTC (permalink / raw)
  To: gcc-gnats


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-03-24 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-24 14:55 c++/5270: MI + virtual base: segfault when throwing an exception in a derived ctor rodrigc
  -- strict thread matches above, loose matches on Subject: below --
2002-01-03 18:46 daniel.elstner

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).