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

FP Stack Trace in Fortran DLL

Nick2
New Contributor I
411 Views
While I'm at it, let me express some frustration for trying to post this and instead getting a web page that said...

Service Unavailable - Zero size object
The server is temporarily unable to service your request. Please try again later.

Reference #15.17b0d040.1250118897.3ef4367


Anyway, I am trying to get a stack trace from a Fortran dll/library upon a floating point crash, such as divide by zero. I've tried to get the same from a managed app calling the Fortran dll. I do get a stack trace, but it only gives me the managed stack trace, leaving out the Fortran part.

So I've tried to write a C++/Fortran combo, and here's what happens:

C++ code calls _set_se_translator
C++ code calls Fortran function
Fortran calls SETENVQQ("FOR_DIAGNOSTIC_LOG_FILE=c:\error_log.txt")
Fortran calls a function
Stated function causes a divide-by-zero crash
I am now in the function registered with _set_se_translator
I "walk the stack" using the Windows API calls, and my stack includes C++ functions, but no Fortran functions.
I don't get the c:\error_log.txt file either

So is there any way to get the FP stack trace from a Fortran dll/library?
0 Kudos
1 Reply
Steven_L_Intel1
Employee
411 Views
If the Fortran exception handler never gets invoked, and it won't when the main program isn't Fortran, then setting FOR_DIAGNOSTIC_LOG_FILE will have no effect for errors that aren't Fortran-specific (I/O errors, etc.) I am not really familiar with C++ structured exception handling, but it might be that the Fortran frames are no longer on the stack. You may want to try adding the option /Oy- to the Fortran compiles. This will preserve the use of EBP as a frame pointer and may help with stack traces.
0 Kudos
Reply