This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14026] New: std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: "hubert dot schmid at stud dot uka dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Feb 2004 10:54:33 -0000
- Subject: [Bug c++/14026] New: std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code shows the problem:
#include <iostream>
int main()
{
try {
throw 1;
} catch (...) {
try {
throw;
} catch (...) {
std::cout << std::uncaught_exception() << std::endl;
}
}
std::cout << std::uncaught_exception() << std::endl;
}
The program prints:
1
1
The expected output is:
0
0
Some detail: std::uncaught_exception() uses a variable (uncaughtExceptions),
that counts the number of uncaught exceptions. The value of this variable is -1
at the two print statements. I guess, this variable is incremented each time an
exception is thrown and decremented each time an exception is caught. I also
guess, that in the above program, the variable is possible not incremented at
the rethrow statement.
--
Summary: std::uncaught_exception is true although there are no
uncaught exceptions (rethrow, ghost exception)
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hubert dot schmid at stud dot uka dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-pc-linux-gnu
GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14026
- Follow-Ups:
- [Bug c++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: hubert dot schmid at stud dot uka dot de
- [Bug c++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: bangerth at dealii dot org
- [Bug libstdc++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: pinskia at gcc dot gnu dot org
- [Bug libstdc++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: pcarlini at suse dot de
- [Bug libstdc++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: pcarlini at suse dot de
- [Bug libstdc++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: pcarlini at suse dot de
- [Bug libstdc++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: cvs-commit at gcc dot gnu dot org
- [Bug libstdc++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: cvs-commit at gcc dot gnu dot org
- [Bug libstdc++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: rth at gcc dot gnu dot org
- [Bug libstdc++/14026] std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception)
- From: pinskia at gcc dot gnu dot org