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

bogus floating point exceptions with ifx 2025.0

Dandy_E_
New Contributor I
383 Views

When compiling and running the attached code sample with ifx 2025.0.4, one gets a bogus floating point exception. Please note that code works well in numerous versions of gfortran, ifort 2021.1.2, ifort 2021.13.0, ifx 2024.2.0 and others, with and w/o check and debug options.

$ make -f Makefile.txt FC=ifx clean main && ./main
rm -f ext_mod.o ext_mod.mod calcdiff.o main.o main
ifx -m64 -fpp -fpe0 -traceback -debug minimal -O2 -fp-model strict -fp-speculation strict -fimf-arch-consistency=true -c ext_mod.f90
ifx -m64 -fpp -fpe0 -traceback -debug minimal -O2 -fp-model strict -fp-speculation strict -fimf-arch-consistency=true -c calcdiff.f90
ifx -m64 -fpp -fpe0 -traceback -debug minimal -O2 -fp-model strict -fp-speculation strict -fimf-arch-consistency=true -c main.f90
ifx -m64 -fpp -fpe0 -traceback -debug minimal -O2 -fp-model strict -fp-speculation strict -fimf-arch-consistency=true -o main ext_mod.o calcdiff.o main.o
forrtl: error (65): floating invalid
Image              PC                Routine            Line        Source
libc.so.6          00007F5E5800F520  Unknown               Unknown  Unknown
main               0000000000405FCB  calcdiff                   20  calcdiff.f90
main               0000000000406273  main                       16  main.f90
main               000000000040517D  Unknown               Unknown  Unknown
libc.so.6          00007F5E57FF6D90  Unknown               Unknown  Unknown
libc.so.6          00007F5E57FF6E40  __libc_start_main     Unknown  Unknown
main               0000000000405095  Unknown               Unknown  Unknown
Aborted (core dumped)

The only thing that can lead to an fpe here is a division by zero via pp. The error happens in an IF-block that shields from the division by zero (line 4 in the sample below).

      pp = max( zppart(ic,izs), zppart(ic,izt) )
      vdiff = 0.d00
      if (pp > 0.d00) then
         vdiff = cdiffc(ic) * abs( zppart(ic,izs) - zppart(ic,izt) ) / (pp*vlen(iv))
      endif

The compile flags shown above are the most restrictive I could gather from the documentation, but all flags I tried that involve -O2 do fail (see Makefile.txt, named such because a file named Makefile can not be uploaded) . Only -O1 or -O0 work with ifx 2025.0.4.

ifx 2025.0.4 fails in numerous other places in our code base even when compiled with the above strict compile flags. That sometimes involves similar simple places like:

IF (T.LE.1200.D00) THEN
   TC = T - 273.D00
   CP = funcTC(TC)
ELSE
   TCL = 1200.D00 - 273.D00
   CP0 = funcTCL(TCL)
   P = MAX(0.D0,ZPART(IC,IZ))
   CP = CP0 + (T - 1200.D00)**(funA(P)) * EXP(funB(P))
ENDIF

where the else branch should actually not be reached.

If anyone could find working compiler flags with some decent optimization involved, I would be grateful.

Labels (1)
0 Kudos
1 Solution
Dandy_E_
New Contributor I
293 Views

seems to have been fixed with ifx (IFX) 2025.1.0 20250317

View solution in original post

0 Kudos
2 Replies
Dandy_E_
New Contributor I
294 Views

seems to have been fixed with ifx (IFX) 2025.1.0 20250317

0 Kudos
Dandy_E_
New Contributor I
137 Views

Just for your information, it was not me who accepted this as a solution. Since I can not use ifx 2025.1 under Windows, due to other issue there, I would rather return to ifx 2025.0.4, if it could be made working properly.

0 Kudos
Reply