This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/655: -fno-rtti breaks exception handling



>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:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]