2

I am trying to compile and run some legacy fortran code on a linux box. At the end of the run, it says:

Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO

I understand that these are warning (see here). My question is: Is there an easy way to get all code line numbers where these warnings originated from? If I used the '-ffpe-trap' option to change these warnings to SIGFPE signals, then I just get the first instance (and the program exits).

I would like something like a list of instances (lines in the code):

code_file1.f:65 (divide by zero)

code_file2.f:92 (invalid flag)

... (etc)

  • 4
    The information is not available in a normal run. The message just tells you that it is *currently* signalling. The compiler does not have any more information. Perhaps some dedicated debugger. – Vladimir F Героям слава Dec 09 '19 at 17:54
  • Hi Vladimir, from the link I have given above, you can see that the fortran '2008 standard requires that execution of the STOP and ERROR STOP statements outputs a list of currently signaling FP exceptions'. From this, I gather that one or more such exceptions have signaled during the running of the code. The OS keeps a list of them, and prints out a summary of that list at the end. My question is whether it is possible to get ALL the lines of code that signaled them. Hence, I can get an idea of the work required to correct all these, and better communicate with the developers of the code. – user7831861 Dec 10 '19 at 06:36
  • I told you, NO, the compiler does not have that information. You would have to find some special software that can do that. – Vladimir F Героям слава Dec 10 '19 at 07:20
  • 1
    I'm not an expert here, but my understanding is that the usual case is all that is known is whether an exception was raised or not - it makes no difference whether the exception was raised 1, 2 or 42 times, all that is known is that it was raised. Thus as Vladimir says you will need some tool over and above what you are using here - either get the compiler to generate code that halts when an undesirable exception is raised, and fix them incrementally, or use a debugger to do similar, or there may be something else I am not aware of. – Ian Bush Dec 10 '19 at 09:26
  • 2
    To add to previous comments, on termination the compiler prints a warning if there is a signalling exception _at the time of termination_. There is no requirement for a compiler to track _when_ the exception arose (although if it leads to termination itself, that's something) or note whether an exception signalled earlier but stopped signalling by the time of termination. – francescalus Dec 10 '19 at 10:38

0 Answers0