[Wien] IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
Pavel Ondračka
pavel.ondracka at email.cz
Wed May 9 17:42:05 CEST 2018
Laurence Marks píše v St 09. 05. 2018 v 11:51 +0000:
> This appears to be due to a silly approach in gfortran, and almost
> certainly is not an error/problem and can be ignored -- see https://s
> tackoverflow.com/questions/44308577/ieee-underflow-flag-ieee-
> denormal-in-fortran-77.
>
While I do agree that in most cases this is harmless, it can also
suggest a bug.
I only looked at dstart for the TiC and I have this specific example:
dstart for a TiC case prints a "Note: The following floating-point
exceptions are signalling: IEEE_DENORMAL" line. If you trap this with
-ffpe-trap='denormal' flag, to inspect in gdb, the offending line is
then:
Program received signal SIGFPE, Arithmetic exception.
0x000000000041dc48 in somm (dr=..., dp=..., dpas=0.013585429144994965,
da=1.1588924125005173e-310, m=0, np=935) at somm.f:10
10 D1=DA+MM
so this line looks completely harmless and some prints show why the
compiler notes about this:
(gdb) print DA
$1 = 1.1588924125005173e-310
(gdb) print MM
$2 = 1
i.e. we just add a really small number (denormal, since DOUBLE_MIN is
around 1.8e-308) to 1, which is completely OK. But lets take a look
where this incredibly small value comes from...
(gdb) up
#1 0x00000000004143c6 in make_spheres (lcore=.FALSE., luse=7) at
make_spheres.F:81
81 call
somm(rat(1,ia),rhoat(1,ia),dx(ia),zamt,0,nptat(ia))
So this is the zamt variable, surprisingly grepping around for zamt
finds nothing. As far as I can see it is not declared or initialized
anywere in dstart. If I just missed something please correct me! The
same goes for the zamt1 and zamt2.
Note that in this case we get lucky since the random memory value is
effectively zero, however this might in my opinion lead to problems if
you hit random memory with another value.
In fact running the dstart in vagrind shows this as well and the
terminal is spammed with "Conditional jump or move depends on
uninitialised value(s)" and "Use of uninitialised value of size 8".
IMO this is a bug, so either the line needs to be changed to
somm(rat(1,ia),rhoat(1,ia),dx(ia),0,0,nptat(ia))
or the zamt variable needs to be declared and initialized somewhere.
But I actually have no idea about the physical meaning of the code so
please correct me if I just missed something.
Best regards
Pavel
More information about the Wien
mailing list