This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17220] New: Incorrect ouput for C++ exceptions with -fomit-frame-pointer
- From: "degraaf at cpsc dot ucalgary dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Aug 2004 00:47:28 -0000
- Subject: [Bug c++/17220] New: Incorrect ouput for C++ exceptions with -fomit-frame-pointer
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code compiles and executes correctly when compiled without
-fomit-frame-pointer, but aborts when compiled with -fomit-frame-pointer:
$ cat registry.cpp
#include <map>
#include <string>
#include <iostream>
using namespace std;
class Registry
{
public:
Registry() : reg() {}
~Registry() {}
void getFloat(string key)
{
map<string, float>::iterator i = reg.find(key);
if (i == reg.end())
throw new int(5);
}
protected:
map<string, float> reg;
};
int main()
{
Registry reg;
string s = "four";
try
{
reg.getFloat(s);
}
catch (...)
{
cout << "caught one" << endl;
}
return 0;
}
$ g++ registry.cpp
$ ./a.out
caught one
$ g++ -fomit-frame-pointer registry.cpp
$ ./a.out
Aborted
$
$ g++ -v
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --disable-libunwind-exceptions --with-system-zlib
--enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
$ uname -a
Linux silmaril.renniedegraaf.homeip.net 2.6.8.1 #1 Sat Aug 21 16:32:26 MDT 2004
i686 athlon i386 GNU/Linux
--
Summary: Incorrect ouput for C++ exceptions with -fomit-frame-
pointer
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: degraaf at cpsc dot ucalgary dot ca
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17220