ifc and g++ exceptions

ifc and g++ exceptions

I have a C++ program that links to some Fortran subroutines which are compiled using ifc-7.1.
The C++ code allocates memory and throws an exception when it cant allocate the desired resources. This causes the program to die with a SIGABRT. And yes, the exception is supposed to be caught in a try - catch block in the calling C++ code.

The system is RH-9 with ifc-7.1-34, gcc version 3.2.2 20030222.

The debugger stack looks like this for the relevant part:

Program received signal SIGABRT, Aborted.
0x40368df1 in kill () from /lib/libc.so.6
(gdb) bt
#0 0x40368df1 in kill () from /lib/libc.so.6
#1 0x40368bbc in raise () from /lib/libc.so.6
#2 0x40369de5 in abort () from /lib/libc.so.6
#3 0x400747cc in GetCurrentFrame32 ()
from /usr/local/wai/intel/compiler70/ia32/lib/libCEPCF90.so.3
#4 0x40074030 in _Unwind_RaiseException ()
from /usr/local/wai/intel/compiler70/ia32/lib/libCEPCF90.so.3
#5 0x402f0d09 in __cxa_throw () from /usr/lib/libstdc++.so.5
#6 0x08054a38 in ArrayData::reallocate(unsigned) (this=0x80671b0,
_ns=750000002) at arraydata.h:235
#7 0x08053e8b in NumArray::resize(unsigned) (this=0x8067194, n=750000002)
at numarray.h:183

The program is linked with g++ and I added
-L/usr/local/wai/intel/compiler70/ia32/lib -lCEPCF90 -lF90 -lunwind
to the linker command line.

Finally ldd shows that the following shared libraries are linked against:

ldd femyp
libCEPCF90.so.3 => /usr/local/wai/intel/compiler70/ia32/lib/libCEPCF90.so.3 (0x40014000)
libF90.so.3 => /usr/local/wai/intel/compiler70/ia32/lib/libF90.so.3 (0x40187000)
libunwind.so.3 => /usr/local/wai/intel/compiler70/ia32/lib/libunwind.so.3 (0x4024a000)
libcxa.so.3 => /usr/local/wai/intel/compiler70/ia32/lib/libcxa.so.3 (0x4024f000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40299000)
libm.so.6 => /lib/libm.so.6 (0x4034c000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4036d000)
libc.so.6 => /lib/libc.so.6 (0x40375000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

My question is: Am I missing an important library or am i linking to the wrong library?


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

We have exactly the same problem when trying to mix C++ and Fortran. (the problem was not solved when we adopted ICC 8.1)

The only way we found to deal with it was to compile everything in "pure" icpc. I mean that we compile every piece of C++ with icpc and the option -cxxlib-icc that link your aplication with intel C++ libraries (default icpc links with GNU C++ libraries).
If you do so you wont have the libstdc++.so dependency anymore, and then your exceptions will be catched correctly.

This is heavy to maintain, we duplicate every library we use (and we use a lot) and we manage two environments as well, but for now its the only solution we have found.


Leave a Comment

Please sign in to add a comment. Not a member? Join today