2

We are using gfortran (5.3.1), Fedora 23, in a new 64 b machine. Compiling with simple gfortran -o (we are not using -ffpe-trap options !), excites the "classical- trivial" warning:

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

Its due to INEXACT exception (type 2.0/3.0). The DDD debugger points towards a real constant (180d0/pi; pi = 3.141518...). We don't understand why this flag appears, with this basic compilation, because these exceptions are reached all the time...

Some code here:

    Implicit none !real*8(a-h,o-z)   
    real*8 pi,dpi,radgra,TSI,TOL,xlsol,fi,W      
    Integer year, T1, k,m

      open(10,file='stof-elem.sol') 

          pi = 4.d0 * datan(1.d0)
         dpi = 2.d0 * pi
       radgra = 360.d0 / dpi !!!!!!!! HERE POINTS THE EXCEPTION!!!!!!!!!!

         T1 = -9998 !800d0 !1450d0 !

        TSI = 1360.d0 !1364.5d0 !1367d0 

        TOL = 0.7d0 / radgra ! dont' use smaller 

C...Name of the output file
      open(12,file='midmonth-2000.sal')

C-----------------------------------------------------------------------
            k = 0 ! outputs counter

            write(12,*)T1            

      DO m = 1, 12  ! select month
           IF(T1.lt.0) then
             xlsol = (270.d0 - dble(m-1) * 30.d0) / radgra !from Dec
               if(xlsol.lt.0d0) xlsol = xlsol + dpi
           ELSE
              xlsol = dble(m-3) * 30.d0 / radgra !from Jan
               if(xlsol.lt.0d0) xlsol = xlsol + dpi
           ENDIF 

            CALL MEANINSOLA(pi,dpi,radgra,TOL,T1,TSI,xlsol,fi,k,W)

            rewind(10) ! better rewind...
      ENDDO

       write(*,*) 'Outputs:', k,'lines'

The EXCEPTION appears at the definition of RADGRA ... as indicated. If redefine the constant (i.e.,, RADGRA = 57.2d0), the exception migrates to another parts using RADGRA... and so on...

distico
  • 35
  • 1
  • 6

1 Answers1

3

As per https://gcc.gnu.org/ml/fortran/2013-06/msg00072.html the Fortran standard requires printing of these notes after executing the STOP statement.

"If any exception (14) is signaling on that image, the processor shall issue a warning indicating which exceptions are signaling; this warning shall be on the unit identified by the named constant ERROR UNIT (13.8.2.8)."

Note that even if you request the Fortran 95 standard by -std=f95 the note is still displayed.

You can control this behaviour by -ffpe-summary=, consult you compiler's manual. By default, a summary for all exceptions but ‘inexact’ is shown. Have you enabled inexact yourself somewhere?

Why is that exception signalling is a different matter, you must examine your code whether it is something you should be worried about or not. Probably you should not, inexact floating point operations are very common.

Because the message is invoked by the STOP statement, a simple way to get rid of these messages is to not terminate your program by a STOP statement, but let it reach the END PROGRAM.

  • Thanks Vladimir F. The outputs are OK ... and the same definitions and code parts are used in another codes with normal compilation and excitation... so; something is not going fine with another code part? – distico Mar 14 '16 at 17:30
  • Please show the **full compilation command** as I asked. The note is probably something you should *not* be worried about, signalling inexact is common, **very common** in fact. – Vladimir F Героям слава Mar 14 '16 at 17:34
  • As I said, using gfortran 5.3.1. with simple compilation: gfortran -o mp.e mp.for. By the way, is standard F77.... Yes, it has STOP, before the END – distico Mar 14 '16 at 17:36
  • Remove the stop -> warning goes away. It us **useless** to have a stop before the end. The code is F77, but the compiler compiles it as F2008. You may try to change to -std=f95, if it changes something (probably not). – Vladimir F Героям слава Mar 14 '16 at 17:39