Strange floating-point exception with ATAN (0)

The following code crashes with a floating point exception:

atan-bug.f90 (301 Bytes)

Compiling and running with nvfortran-20.11 on x86:

% nvfortran -O -gopt -Ktrap=fp atan-bug.f90 && ./a.out
0.1000000000000000 2.2250738585072014E-308 2.2250738585072014E-307
Gleitkomma-Ausnahme (Speicherabzug geschrieben)

Thus a small argument to atan works, but not zero.

(I know that a workaround here would be to use atan2()).

Running under gdb:

Using host libthread_db library “/lib64/”.
0.1000000000000000 2.2250738585072014E-308 2.2250738585072014E-307

Program received signal SIGFPE, Arithmetic exception.
0x00001555539982a5 in __fd_atan_1_avx2 ()
from /work/nvidia/hpc_sdk/Linux_x86_64/20.11/compilers/lib/

Is this a known issue? Or should I rather avoid using -Ktrap=fp?

Thanks anlauf. We were able to reproduce the issue here and filed TPR #29545 to track.

The work arounds are to either not enable floating point traps or add the flag “-Kieee” so the AVX2 version of ATAN is not used.