Bug 14036 - exp(-1234) fails to set the underflow exception flag
Summary: exp(-1234) fails to set the underflow exception flag
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2012-04-29 21:43 UTC by Richard B. Kreckel
Modified: 2014-06-25 11:10 UTC (History)
0 users

See Also:
Last reconfirmed:
fweimer: security-

test case (374 bytes, text/x-csrc)
2012-04-29 21:43 UTC, Richard B. Kreckel

Note You need to log in before you can comment on or make changes to this bug.
Description Richard B. Kreckel 2012-04-29 21:43:36 UTC
Created attachment 6382 [details]
test case

Using the current HEAD of glibc on an x86-64 system, 

When I run the attached program using current HEAD after compiling glibc on an x86-64 system, I get:

exp(710) returned inf
IEEE754 exception flags: none
exp(-1234) returned 0
IEEE754 exception flags: none

The first one should have set the OVERFLOW exception flag, the second one the UNDERFLOW exception flag.

(This appears to have broken recently.)
Comment 1 Joseph Myers 2012-05-05 19:47:25 UTC
Overflow case fixed by:

commit 41498f4db1ebfeb2fb76b9137cba38c20000f1d3
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Sat May 5 19:37:39 2012 +0000

    Fix missing exceptions from exp (bugs 13787, 13922, 14036).

The underflow case is probably a compiler bug, wrongly optimizing a multiplication of two tiny constants to 0, but when Andreas's patch to use -frounding-math for building libm goes in that should work around that compiler bug.
Comment 2 Joseph Myers 2012-05-05 19:48:42 UTC
(Retitling for the underflow issue and reopening until that is properly fixed.)
Comment 3 Joseph Myers 2012-05-06 12:42:14 UTC
Underflow case now fixed, presumably by:

commit bd7b0e561f7f684cedfc4adb964569fe9ab16209
Author: Andreas Jaeger <aj@suse.de>
Date:   Sun May 6 09:14:15 2012 +0200

    Build glibc with -frounding-math
        * Makeconfig (+math-flags): New, set to -frounding-math.
        (+cflags): Add +math-flags so that all of glibc gets compiled with

Should be closed as fixed once libm-test.inc supports testing underflow exceptions and an appropriate test has been added.
Comment 4 Joseph Myers 2012-05-24 15:40:25 UTC
Testcase added by:

commit 7a25eb06bfa838900bef78b975c38aa7e012b587
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu May 24 15:36:54 2012 +0000

    Add tests for underflow exception bugs 10846, 14036.