- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
we use the (very useful) compiler option "-check uninit" to detect uninitialized variables at run-time for third party Fortran subroutines. I have to replace the abort and console message by a more user friendly method:
1) the message should be written to a logfile instead of console (at least the name of the uninitialized variable)
2) the program should continue execution as if "-check uninit" was not specified
In the threadhttp://software.intel.com/en-us/forums/showthread.php?t=52304Jugoslav Dujic suggested to overwrite the functionfor_emit_diagnostic. Infortunately the original post he referenced is no longer available. If I write an own for_emit_diagnostic it is not called/used from the internal functions in the fortran runtime lib.
But a similiar idea worked: I have written an ownfor__rtc_uninit_use to replace the call to the original runtime error handler. Returning from this function continues execution of the Fortran program.
So my questions are:
1) Is the implementation of an own for__rtc_uninit_use currently the only possibility to catch these errors or is there a "more official" way?
2) Currently for__rtc_uninit_use gets a pointer to the variable name as argument - can I rely on this (at least for a specific compiler version) to print out the name of the uninitialized variable?
This was only tested on Linux, but I hope the same works on Windows too.
Regards,
Bernhard.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, I believe that the compiler may believe that the call doesn't return - if you return then you MIGHT execute the wrong code path.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I checked the disassembled code and for__rtc_uninit_use can return (if for__issue_diagnostics returns), so I hope the calling code handles this correctly. I thought it must be possible to define an uninitialized variable error to a non-fatal warning.
Tests with complex routines were successfull too. We don't bother the undefined result if uninitialized variables are used, but it is important to keep the program running to save any open data (which does not depend on the called Fortran routine)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In compiler version 14 we added the ESTABLISHQQ routine to let you intercept run-time errors.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page