Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28632 Discussions

Fortran program linked with C++ library aborts

israelhsu
Beginner
417 Views
Hi, I hope somebody can help with the following issue:

I have a Fortran program compiled and statically linked by ifort, and one of the libraries it links to has C++ code. (The interface to the C++ code is composed of extern "C" functions.) During normal operation, the C++ code uses C++'s throw/catch exception handling mechanism. The problem is that when the code is called by this Fortran program, the process aborts when an exception is thrown.

The C++ library was compiled with gcc 3.2.2 in RedHat 9.

In essence, Fortran code calls an extern "C" function. The extern "C" function calls a C++ function which throws (and should catch) an exception. But when the exception is thrown, the process aborts.

The stack dump is

Program received signal SIGABRT, Aborted.
0x0812b9e1 in kill ()
(gdb) where
#0 0x0812b9e1 in kill ()
#1 0x0811517a in __pthread_raise ()
#2 0x0812bd29 in abort ()
#3 0x080b4197 in __cxxabiv1::__terminate(void (*)()) ()
#4 0x080b41e4 in std::terminate() ()
#5 0x080b4356 in __cxa_throw ()
#6 0x0807c124 in CLUDPImpl::select2(int, CL_Addrs&, CL_Addrs&, timeval*, bool,
bool) ()

Thanks.
0 Kudos
2 Replies
TimP
Honored Contributor III
417 Views
You didn't mention ifort versions; you should be using the latest (8.0.040) for maximum compatibility. Beyond that, I can onlyremind youthat it has not been possible to offer full support forred hat 9. I don't enjoy the continued struggle with installing various versions of linux either.
0 Kudos
israelhsu
Beginner
417 Views
Hm. I'm using version 8.0...

> ifort -V
Intel Fortran Compiler for 32-bit applications, Version 8.0 Build 20031016Z Package ID: l_fc_p_8.0.034

Has anyone observed the aforementioned problem? or am i the first one...

Thanks
--Israel Hsu
0 Kudos
Reply