public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
       [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
@ 2014-03-21 15:33 ` redi at gcc dot gnu.org
  2014-03-21 15:59 ` tasptz at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-21 15:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-21
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In C++11 destructors have an implicit noexcept, so the 4.7 behaviour is wrong:
the program should call std::terminate() when the exception leaves ~A()

If you change the program to:

    ~A() noexcept(false)

then it runs and exits normally.

If you explicitly add:

    ~A() noexcept(true)

then you get the same behaviour from 4.7 and 4.8, it segfaults in the terminate
handler.


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

* [Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
       [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
  2014-03-21 15:33 ` [Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault redi at gcc dot gnu.org
@ 2014-03-21 15:59 ` tasptz at gmail dot com
  2014-03-21 16:08 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: tasptz at gmail dot com @ 2014-03-21 15:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

tasptz at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from tasptz at gmail dot com ---
Thanks, Jonathan.


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

* [Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
       [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
  2014-03-21 15:33 ` [Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault redi at gcc dot gnu.org
  2014-03-21 15:59 ` tasptz at gmail dot com
@ 2014-03-21 16:08 ` redi at gcc dot gnu.org
  2014-03-21 18:40 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-21 16:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
         Resolution|INVALID                     |---

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is not invalid, it's a bug: the terminate handler should terminate, not
segfault


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

* [Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
       [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-03-21 16:08 ` redi at gcc dot gnu.org
@ 2014-03-21 18:40 ` redi at gcc dot gnu.org
  2014-03-21 18:47 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-21 18:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
When I step through std::rethrow_exception() in gdb it goes from line 215 to
line 223, so skips over the call to get_terminate(), so dep->terminateHandler
is null and so is dep->unwindHeader.exception_cleanup

(gdb) bt
#0  std::rethrow_exception (ep=...) at
/home/jwakely/src/gcc/gcc/libstdc++-v3/libsupc++/eh_ptr.cc:223
#1  0x0000000000400d39 in A::~A (this=0x7fffffffd9df, __in_chrg=<optimized
out>) at ep.cc:19
#2  0x0000000000400c4c in main () at ep.cc:28
(gdb) p *dep
$17 = {primaryException = 0x603090, unexpectedHandler = 0x7ffff7d3a7c0
<std::terminate()>, terminateHandler = 0x0, nextException = 0x0, handlerCount =
0, handlerSwitchValue = 0, actionRecord = 0x0, languageSpecificData = 0x0, 
  catchTemp = 0, adjustedPtr = 0x0, unwindHeader = {exception_class = 0,
exception_cleanup = 0x0, private_1 = 0, private_2 = 0}}


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

* [Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
       [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-03-21 18:40 ` redi at gcc dot gnu.org
@ 2014-03-21 18:47 ` redi at gcc dot gnu.org
  2014-03-21 23:55 ` [Bug libstdc++/60612] " redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-21 18:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*Sigh* -- ignore that. After line 223 it jumps back to 216 then continues back
to 223 again with the right values in *dep. I thought I was debugging an
unoptimised libstdc++.so but apparently not.


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

* [Bug libstdc++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
       [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-03-21 18:47 ` redi at gcc dot gnu.org
@ 2014-03-21 23:55 ` redi at gcc dot gnu.org
  2014-03-27 18:08 ` redi at gcc dot gnu.org
  2014-03-27 18:08 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-21 23:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
          Component|c++                         |libstdc++
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
   Target Milestone|---                         |4.8.3

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is a bug in libsupc++, I have a patch to fix it.


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

* [Bug libstdc++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
       [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2014-03-27 18:08 ` redi at gcc dot gnu.org
@ 2014-03-27 18:08 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-27 18:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|4.8.3                       |4.9.0

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 4.9.0


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

* [Bug libstdc++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
       [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-03-21 23:55 ` [Bug libstdc++/60612] " redi at gcc dot gnu.org
@ 2014-03-27 18:08 ` redi at gcc dot gnu.org
  2014-03-27 18:08 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-27 18:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60612

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu Mar 27 18:07:25 2014
New Revision: 208871

URL: http://gcc.gnu.org/viewcvs?rev=208871&root=gcc&view=rev
Log:
    PR libstdc++/60612
    * libsupc++/eh_ptr.cc: Assert __cxa_dependent_exception layout is
    compatible with __cxa_exception.
    * libsupc++/unwind-cxx.h (__cxa_dependent_exception): Add padding.
    Fix typos in comments.
    * testsuite/18_support/exception_ptr/60612-terminate.cc: New.
    * testsuite/18_support/exception_ptr/60612-unexpected.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/18_support/exception_ptr/60612-terminate.cc
    trunk/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/libsupc++/eh_ptr.cc
    trunk/libstdc++-v3/libsupc++/unwind-cxx.h


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

end of thread, other threads:[~2014-03-27 18:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-60612-4@http.gcc.gnu.org/bugzilla/>
2014-03-21 15:33 ` [Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault redi at gcc dot gnu.org
2014-03-21 15:59 ` tasptz at gmail dot com
2014-03-21 16:08 ` redi at gcc dot gnu.org
2014-03-21 18:40 ` redi at gcc dot gnu.org
2014-03-21 18:47 ` redi at gcc dot gnu.org
2014-03-21 23:55 ` [Bug libstdc++/60612] " redi at gcc dot gnu.org
2014-03-27 18:08 ` redi at gcc dot gnu.org
2014-03-27 18:08 ` redi at gcc dot gnu.org

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