public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12054] New: Improper handling of exception throw while constructing exception
@ 2003-08-25 14:52 sabre at nondot dot org
  2003-08-25 15:50 ` [Bug c++/12054] " bangerth at dealii dot org
  2003-08-27 18:54 ` jason at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: sabre at nondot dot org @ 2003-08-25 14:52 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Improper handling of exception throw while constructing
                    exception
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sabre at nondot dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

According to http://www.codesourcery.com/cxx-abi/abi-eh.html#cxx-throw,
this program should print success, but instead it calls terminate.

#include <stdio.h>

struct foo {
  foo() {}
  foo(const foo &F) { throw 1; }
};

int main() {
        try {
                foo f;
                throw f;
        } catch (int i) {
                printf("Success!\n");
                return 0;
        }
}


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

* [Bug c++/12054] Improper handling of exception throw while constructing exception
  2003-08-25 14:52 [Bug c++/12054] New: Improper handling of exception throw while constructing exception sabre at nondot dot org
@ 2003-08-25 15:50 ` bangerth at dealii dot org
  2003-08-27 18:54 ` jason at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bangerth at dealii dot org @ 2003-08-25 15:50 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-25 15:50:35
               date|                            |


------- Additional Comments From bangerth at dealii dot org  2003-08-25 15:50 -------
Nathan confirmed this already here: 
  http://gcc.gnu.org/ml/gcc/2003-08/msg01424.html 
 
W.


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

* [Bug c++/12054] Improper handling of exception throw while constructing exception
  2003-08-25 14:52 [Bug c++/12054] New: Improper handling of exception throw while constructing exception sabre at nondot dot org
  2003-08-25 15:50 ` [Bug c++/12054] " bangerth at dealii dot org
@ 2003-08-27 18:54 ` jason at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu dot org @ 2003-08-27 18:54 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


jason at gcc dot gnu dot org changed:

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


------- Additional Comments From jason at gcc dot gnu dot org  2003-08-27 18:54 -------
This is not a bug.

      15.5.1 The terminate() function           [except.terminate]
1     In the following situations exception handling must be abandoned for
           less subtle error handling techniques:
      -  when the exception handling mechanism, after completing evaluation
           of the expression to be thrown but
          before the exception is caught (15.1), calls a user function that
           exits via an uncaught exception,134)
      -  when the exception handling mechanism cannot find a handler for a
           thrown exception (15.3), or
      -  when the destruction of an object during stack unwinding (15.2)
           exits using an exception, or
      __________________
      134) For example, if the object being thrown is of a class with a
           copy constructor, terminate() will be called if that copy construc-
      tor exits with an exception during a throw.

Indeed, the cited section of the ABI document says
  
  (If the copy constructor itself exits by throwing an exception,
  terminate() is called.)


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-25 14:52 [Bug c++/12054] New: Improper handling of exception throw while constructing exception sabre at nondot dot org
2003-08-25 15:50 ` [Bug c++/12054] " bangerth at dealii dot org
2003-08-27 18:54 ` jason at gcc dot gnu dot 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).