[Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault

2014-03-21 Thread redi at gcc dot gnu.org
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.


[Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault

2014-03-21 Thread tasptz at gmail dot com
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.


[Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault

2014-03-21 Thread redi at gcc dot gnu.org
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


[Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault

2014-03-21 Thread redi at gcc dot gnu.org
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  0x00400d39 in A::~A (this=0x7fffd9df, __in_chrg=optimized
out) at ep.cc:19
#2  0x00400c4c in main () at ep.cc:28
(gdb) p *dep
$17 = {primaryException = 0x603090, unexpectedHandler = 0x77d3a7c0
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}}


[Bug c++/60612] Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault

2014-03-21 Thread redi at gcc dot gnu.org
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.