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

no traceback with -static-libgcc ?

Janus
New Contributor I
856 Views

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:

$ ./a.out
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:

https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide-and-reference-static-libgcc

https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide-and-reference-tracebackqq

Cheers,

Janus

0 Kudos
3 Replies
Janus
New Contributor I
856 Views

No answer for more than a week. Obviously a bug. I opened a support request.

Cheers,

Janus

0 Kudos
Juergen_R_R
Valued Contributor I
856 Views

I could confirm this behaviour.  

0 Kudos
Janus
New Contributor I
856 Views

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.

Cheers,

Janus

0 Kudos
Reply