No response from maintainer in a week, so I'm sending this to [EMAIL PROTECTED]
I'm working on an OpenBSD port of linuxdcpp. It requires at least g++
3.4 due to some template features not present in the default 3.3.5. I
tried using g++ 4.2 from ports, and while it does compile fine, it
aborts whenever an exception is thrown (on amd64). As an example of the
issue:
$ uname -m
amd64
$ cat exception_test3.cc
#include <iostream>
using namespace std;
class B {};
int main(int argc, char** argv) {
try { throw B(); }
catch(const B&) { cerr << "caught a B" << endl; }
}
$ g++ -o t exception_test3.cc && ./t
caught a B
$ eg++ -o t exception_test3.cc && ./t
/usr/local/lib/gcc/amd64-unknown-openbsd4.2/4.2.0/../../../libestdc++.so.7.0:
warning: vsprintf() is often misused, please use vsnprintf()
/usr/local/lib/gcc/amd64-unknown-openbsd4.2/4.2.0/../../../libestdc++.so.7.0:
warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/gcc/amd64-unknown-openbsd4.2/4.2.0/../../../libestdc++.so.7.0:
warning: sprintf() is often misused, please use snprintf()
/usr/local/lib/gcc/amd64-unknown-openbsd4.2/4.2.0/../../../libestdc++.so.7.0:
warning: strcat() is almost always misused, please use strlcat()
terminate called after throwing an instance of 'B'
terminate called recursively
Abort trap (core dumped)
Here's the same program on i386:
$ uname -m
i386
$ cat exception_test3.cc
#include <iostream>
using namespace std;
class B {};
int main(int argc, char** argv) {
try { throw B(); }
catch(const B&) { cerr << "caught a B" << endl; }
}
$ g++ -o t exception_test3.cc && ./t
caught a B
$ eg++ -o t exception_test3.cc && ./t
/usr/local/lib/gcc/i386-unknown-openbsd4.2/4.2.0/../../../libestdc++.so.7.0:
warning: vsprintf() is often misused, please use vsnprintf()
/usr/local/lib/gcc/i386-unknown-openbsd4.2/4.2.0/../../../libestdc++.so.7.0:
warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/gcc/i386-unknown-openbsd4.2/4.2.0/../../../libestdc++.so.7.0:
warning: sprintf() is often misused, please use snprintf()
/usr/local/lib/gcc/i386-unknown-openbsd4.2/4.2.0/../../../libestdc++.so.7.0:
warning: strcat() is almost always misused, please use strlcat()
caught a B
The amd64 is running 4.2-release and not -current, but it's the only
amd64 box I can test with. The code works on a 4.1-stable i386 box I
tried it on as well, but it failed on the 4.1-stable amd64 box (before I
upgraded it to 4.2).
Is this a known issue with g++ on amd64? Are there any workarounds? If
not, should g++ 4.2 be marked broken on amd64?
Thanks for any help you can provide.
Jeremy