This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/36032] New: -fno-exceptions breaks simple if-statement.
- From: "gcc-bugzilla at contacts dot eelis dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Apr 2008 03:42:31 -0000
- Subject: [Bug libstdc++/36032] New: -fno-exceptions breaks simple if-statement.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider:
#include <iostream>
int main()
{
if(true) try {} catch(int) {}
else std::cout << "bla\n";
}
When compiled without -fno-exceptions, "bla" is not printed (which is correct).
When compiled /with/ -fno-exceptions, "bla" /is/ printed (which is not
correct).
This appears to be due to the following overly simplistic definitions in
libsupc++/exception_defines.h:
#ifndef __EXCEPTIONS
// Iff -fno-exceptions, transform error handling code to work without it.
# define try if (true)
# define catch(X) if (false)
--
Summary: -fno-exceptions breaks simple if-statement.
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc-bugzilla at contacts dot eelis dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36032