Please consider this trivial code snippet, which does nothing else but generate a backtrace:
program tb use ifcore call TRACEBACKQQ end
Compiling this with ifort 18 using the -traceback flag yields the expected result:
Image PC Routine Line Source
a.out 0000000000404391 Unknown Unknown Unknown
a.out 0000000000400AA4 MAIN__ 5 backtrace.f90
a.out 0000000000400A4E Unknown Unknown Unknown
a.out 000000000048B636 Unknown Unknown Unknown
a.out 000000000048B82A Unknown Unknown Unknown
a.out 0000000000400929 Unknown Unknown Unknown
However, when adding the -static-libgcc flag on a Linux system, the backtrace completely disappears and the program does not produce any output. I observed this not only for an explicit call to TRACEBACKQQ, but also for runtime errors, which usually give a backtrace as well (but not with -static-libgcc). Interestingly a fully statically linked executable (using the -static flag) gives backtraces without any problem.
Is it somehow expected that -static-libgcc kills my backtraces, or can this be considered an ifort bug? The documentation does not seem to mention anything in this direction:
Thanks for the confirmation, Juergen. In fact I see no good reason why -static-libgcc should prevent ifort from throwing a stack trace.
Incidentally GCC/gfortran has the same -static-libgcc flag, and there it doesn't affect the stack traces in any way. The test case is slightly different:
program tb_gfortran call BACKTRACE end
But compiling this with "gfortran -static-libgcc -static-libgfortran -g" gives me a beautiful backtrace, just as it does without the -static-... flags.