[Wien] IEEE_UNDERFLOW_FLAG IEEE_DENORMAL

Pavel Ondračka pavel.ondracka at email.cz
Wed May 9 21:11:48 CEST 2018


---------- Původní e-mail ----------
Od: Laurence Marks <L-marks at northwestern.edu>
Komu: A Mailing list for WIEN2k users <wien at zeus.theochem.tuwien.ac.at>
Datum: 9. 5. 2018 18:18:21
Předmět: Re: [Wien] IEEE_UNDERFLOW_FLAG IEEE_DENORMAL 
"
Zamt is set by somm, which is a slightly inaccurate Simpson summation (the 
accuracy does not matter). Hence it does not need to be set previously.

"



Right, it is indeed set in the somm subroutine. The problem is that the DA 
variable (the local name for zamt variable in the somm subroutine) is set 
for the first time on line 11, while it is used (read) for the first time 
earlier on line 10 (and this is the line when the gcc and valgrind 
complains)! Hence when the subroutine is called for the first time, the 
results depends on read from uninitialized memory.

Best regards

Pavel


 
"


_____
Professor Laurence Marks
"Research is to see what everybody else has seen, and to think what nobody 
else has thought", Albert Szent-Gyorgi
www.numis.northwestern.edu(http://www.numis.northwestern.edu)




On Wed, May 9, 2018, 10:42 AM Pavel Ondračka <pavel.ondracka at email.cz
(mailto:pavel.ondracka at email.cz)> wrote:

"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://
urldefense.proofpoint.com/v2/url?u=https-3A__s&d=DwIGaQ&c=yHlS04HhBraes5BQ9
ueu5zKhE7rtNXt_d012z2PA6ws&r=U_T4PL6jwANfAy4rnxTj8IUxm818jnvqKFdqWLwmqg0&m=R
1lxmwh4Y3r4yRx1ZyR4NN9mpSe7RuaT974qRm6Uhfw&s=KDobN5dacXxTk7OUpO1BdJBY45FBX34
Hf6Q9hTempg0&e=
(https://urldefense.proofpoint.com/v2/url?u=https-3A__s&d=DwIGaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=U_T4PL6jwANfAy4rnxTj8IUxm818jnvqKFdqWLwmqg0&m=R1lxmwh4Y3r4yRx1ZyR4NN9mpSe7RuaT974qRm6Uhfw&s=KDobN5dacXxTk7OUpO1BdJBY45FBX34Hf6Q9hTempg0&e=)
> tackoverflow.com/questions/44308577/ieee-underflow-flag-ieee-
(http://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
_______________________________________________
Wien mailing list
Wien at zeus.theochem.tuwien.ac.at(mailto:Wien at zeus.theochem.tuwien.ac.at)
https://urldefense.proofpoint.com/v2/url?u=http-3A__zeus.theochem.tuwien.ac.
at_mailman_listinfo_wien&d=DwIGaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA
6ws&r=U_T4PL6jwANfAy4rnxTj8IUxm818jnvqKFdqWLwmqg0&m=R1lxmwh4Y3r4yRx1ZyR4NN9
mpSe7RuaT974qRm6Uhfw&s=_8Uru9zRH580QrhtgA9HnU1x81x6paXIOqJCFnOzZME&e=
(https://urldefense.proofpoint.com/v2/url?u=http-3A__zeus.theochem.tuwien.ac.at_mailman_listinfo_wien&d=DwIGaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=U_T4PL6jwANfAy4rnxTj8IUxm818jnvqKFdqWLwmqg0&m=R1lxmwh4Y3r4yRx1ZyR4NN9mpSe7RuaT974qRm6Uhfw&s=_8Uru9zRH580QrhtgA9HnU1x81x6paXIOqJCFnOzZME&e=)
SEARCH the MAILING-LIST at:  https://urldefense.proofpoint.com/v2/url?u=http
-3A__www.mail-2Darchive.com_wien-40zeus.theochem.tuwien.ac.at_index.html&d=
DwIGaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=U_T4PL6jwANfAy4rnxTj8
IUxm818jnvqKFdqWLwmqg0&m=R1lxmwh4Y3r4yRx1ZyR4NN9mpSe7RuaT974qRm6Uhfw&s=SJYF9
VBF7xwkjpCyB76TXcIRXzDcFX3xCQlsoQ4RwIw&e=
(https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mail-2Darchive.com_wien-40zeus.theochem.tuwien.ac.at_index.html&d=DwIGaQ&c=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws&r=U_T4PL6jwANfAy4rnxTj8IUxm818jnvqKFdqWLwmqg0&m=R1lxmwh4Y3r4yRx1ZyR4NN9mpSe7RuaT974qRm6Uhfw&s=SJYF9VBF7xwkjpCyB76TXcIRXzDcFX3xCQlsoQ4RwIw&e=)
"
_______________________________________________ 
Wien mailing list 
Wien at zeus.theochem.tuwien.ac.at 
http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien 
SEARCH the MAILING-LIST at: http://www.mail-archive.com/wien@zeus.theochem.
tuwien.ac.at/index.html 
"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://zeus.theochem.tuwien.ac.at/pipermail/wien/attachments/20180509/a8b27758/attachment.html>


More information about the Wien mailing list