This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/655: -fno-rtti breaks exception handling
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/655: -fno-rtti breaks exception handling
- From: msteed at altiris dot com
- Date: 18 Oct 2000 16:26:52 -0000
- Reply-To: msteed at altiris dot com
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, jason at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, msteed@altiris.com
>Number: 655
>Category: c++
>Synopsis: -fno-rtti breaks exception handling
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Wed Oct 18 09:36:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Mike Steed
>Release: gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Linux-2.2.13/i686
>Description:
The gcc documentation for "-fno-rtti" says: ".... Note that exception handling uses the same information, but it will generate it as needed." This implies that it is okay to uses -fno-rtti on code that uses exceptions, and the compiler will generate what it needs.
But -- compile the source below as follows:
gcc -fno-rtti main.cpp -lstdc++
The executable will produce a segmentation fault.
If exceptions do require that RTTI be enabled, the documentation on -fno-rtti should be clarified.
>How-To-Repeat:
// Compile as gcc -fno-rtti main.cpp -lstdc++
class Exception
{
public: Exception() { }
};
int
main(int, char **)
{
try {
throw Exception();
}
catch (...) {
}
return 0;
}
>Fix:
Omit the -fno-rtti switch on code that uses exceptions.
>Release-Note:
>Audit-Trail:
>Unformatted: