Exceptions on AIX causing IOT/Abort trap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm running AIX 6.1 and I am seeing different behavior between
versions of g++ when catching exceptions.  I'll focus on g++ 4.8.5 and
4.9.3 since that's where I first saw the difference, though g++ 5.3.0
behaves the same as 4.9.3.

If I dynamically link (the default) libgcc and libstdc++, everything
works fine.  If I statically link both so that the resulting binary
has no dependencies on libgcc or libstdc++, the second exception that
is thrown causes "IOT/Abort trap (core dumped)" in 4.9.3 but not in
4.8.5 (nor in 4.7.1).

I have seem many references to exceptions being thrown across library
boundaries causing issues, but this is within the same .cpp file.  It
is also odd that the first exception appears to work fine, but the
second has an error.

Does anyone have any idea what may have changed between 4.8 and 4.9?
Is there some gcc configure option that I am missing out on?  How can
I even attempt to figure out what the root cause of the problem is in
this type of situation?

I compiled g++ myself in all cases, g++ -v shows:
==========
Using built-in specs.
COLLECT_GCC=/opt/act-gcc-4.8.5/bin/g++
COLLECT_LTO_WRAPPER=/opt/act-gcc-4.8.5/libexec/gcc/powerpc-ibm-aix6.1.0.0/4.8.5/lto-wrapper
Target: powerpc-ibm-aix6.1.0.0
Configured with: /opt/bg/act-gcc-4.8.5-sandbox/gcc-4.8.5/configure
--prefix=/opt/act-gcc-4.8.5 --enable-languages=c,c++
--with-pkgversion=act-gcc-4.8.5
Thread model: aix
gcc version 4.8.5 (act-gcc-4.8.5)
==========
Using built-in specs.
COLLECT_GCC=/opt/act-gcc-4.9.3/bin/g++
COLLECT_LTO_WRAPPER=/opt/act-gcc-4.9.3/libexec/gcc/powerpc-ibm-aix6.1.0.0/4.9.3/lto-wrapper
Target: powerpc-ibm-aix6.1.0.0
Configured with: /opt/bg/act-gcc-4.9.3-sandbox/gcc-4.9.3/configure
--prefix=/opt/act-gcc-4.9.3 --enable-languages=c,c++
--with-pkgversion=act-gcc-4.9.3
Thread model: aix
gcc version 4.9.3 (act-gcc-4.9.3)
==========

To link dynamically (works on all versions):
g++ -o test test.cpp

To link statically (works in 4.8.5 and earlier):
g++ -o test test.cpp -Wl,-bstatic -lstdc++ -Wl,-bdynamic
-static-libgcc -static-libstdc++ -lsupc++


test.cpp
==========
#include <iostream>
void throw_int(int n) { throw n; }
int main(int argc, char *argv[])
{
    try {
        throw_int(1);
    } catch (int n) {
        std::cout << "First: " << n << std::endl;
    }
    try {
        throw_int(2);
    } catch (int n) {
        std::cout << "Second: " << n << std::endl;
    }
    return 0;
}
==========



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux