Project

General

Profile

Actions

Bug #1997

closed

C++ exception handling problems with -m64?

Added by Justin Santa Barbara over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
2012-01-18
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

I'm having some problems with C++ and -m64, where it works with -m32. I'm running OI151a with GCC 4.6.2 from SFE. The exception is caught with -m32 (as expected), but with -m64 it is not caught and terminate is called. Simple test case below:

mkdir test2
cd test2
cat > test.cc <<EOF
#include <memory>
#include <iostream>
#include <stdexcept>

using namespace std;

int main() {
try {
throw invalid_argument("Hello world");
} catch (exception& e) {
cerr << "Caught exception\n";
}
return 0;
}
EOF

g++ -m32 test.cc; ./a.out
  1. Caught exception
g++ -m64 test.cc; ./a.out
  1. terminate called after throwing an instance of 'std::invalid_argument'
  2. Abort (core dumped)

uname -a
#SunOS openindiana 5.11 oi_151a i86pc i386 i86pc Solaris

g++ --version
#g++ (GCC) 4.6.2

Actions

Also available in: Atom PDF