public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/61643] New: [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested
@ 2014-06-29  5:55 ai.azuma at gmail dot com
  2014-10-07  9:01 ` [Bug libstdc++/61643] " ai.azuma at gmail dot com
  2014-10-07  9:02 ` ai.azuma at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: ai.azuma at gmail dot com @ 2014-06-29  5:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61643

            Bug ID: 61643
           Summary: [C++11] std::uncaught_exception returns wrong values
                    after std::rethrow_if_nested
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ai.azuma at gmail dot com

The following program should terminate successfully.

//=========================================================
#include <stdexcept>
#include <exception>
#include <cstdlib>

struct X
{
  ~X() {
    if (!std::uncaught_exception()) std::abort();    // (A)
  }
};

int main() {
  try {
    throw std::runtime_error("");
  }
  catch (...) {
    try {
      std::throw_with_nested(std::runtime_error(""));
    }
    catch (std::runtime_error const &e) {
      try {
        X x;
        std::rethrow_if_nested(e);
      }
      catch (std::runtime_error const &e) {
        if (std::uncaught_exception()) std::abort(); // (B)
      }
    }
  }
  return EXIT_SUCCESS;
}
//=========================================================

However, the program is aborted at the line marked with `(A)', and at the line
marked with `(B)' if the line marked with `(A)' is commented out.

This problem is reproduced with 4.10.0 20140622, 4.9.1 20140625 and 4.8.4
20140619. The reproducer requires -std=c++11 flag to compile.


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

* [Bug libstdc++/61643] [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested
  2014-06-29  5:55 [Bug libstdc++/61643] New: [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested ai.azuma at gmail dot com
@ 2014-10-07  9:01 ` ai.azuma at gmail dot com
  2014-10-07  9:02 ` ai.azuma at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ai.azuma at gmail dot com @ 2014-10-07  9:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61643

Ai Azuma <ai.azuma at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
      Known to fail|4.10.0, 4.9.1               |4.9.2, 5.0

--- Comment #1 from Ai Azuma <ai.azuma at gmail dot com> ---
See Comment 2 in PR62258. The proposed patch attached in that comment make the
above test case work properly.


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

* [Bug libstdc++/61643] [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested
  2014-06-29  5:55 [Bug libstdc++/61643] New: [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested ai.azuma at gmail dot com
  2014-10-07  9:01 ` [Bug libstdc++/61643] " ai.azuma at gmail dot com
@ 2014-10-07  9:02 ` ai.azuma at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ai.azuma at gmail dot com @ 2014-10-07  9:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61643

Ai Azuma <ai.azuma at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #2 from Ai Azuma <ai.azuma at gmail dot com> ---


*** This bug has been marked as a duplicate of bug 62258 ***


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

end of thread, other threads:[~2014-10-07  9:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-29  5:55 [Bug libstdc++/61643] New: [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested ai.azuma at gmail dot com
2014-10-07  9:01 ` [Bug libstdc++/61643] " ai.azuma at gmail dot com
2014-10-07  9:02 ` ai.azuma at gmail dot com

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