diff options
author | Joseph Myers <joseph@codesourcery.com> | 2015-10-07 23:45:29 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2015-10-07 23:45:29 +0000 |
commit | 8afdb7ac1ecadf82abdb16a5fcfadf9537ca3d84 (patch) | |
tree | 169c0bffb741e4fb32fd61098af49445dac0cff9 /NEWS | |
parent | 939e092a9e46e6a8bb3d7dc3cf165f384b598f46 (diff) | |
download | glibc-8afdb7ac1ecadf82abdb16a5fcfadf9537ca3d84.tar.gz glibc-8afdb7ac1ecadf82abdb16a5fcfadf9537ca3d84.tar.xz glibc-8afdb7ac1ecadf82abdb16a5fcfadf9537ca3d84.zip |
Fix lround, llround missing exceptions close to overflow threshold (bug 19088).
The dbl-64, ldbl-96 and ldbl-128 implementations of lround and llround fail to produce "invalid" exceptions in cases where the rounded result overflows the target type, but truncating the floating-point argument to the next integer towards zero does not overflow it (so in particular casts do not produce such exceptions). (This issue cannot arise for float, or for double with 64-bit target type, or for ldbl-96 with 64-bit target type and negative arguments, because of insufficient precision in the floating-point type for arguments with the relevant property to exist.) This patch fixes these problems by inserting checks for the special cases that can occur in each implementation, and explicitly raising FE_INVALID (and avoiding the cast if it might raise spurious FE_INEXACT). Tested for x86_64, x86 and mips64. [BZ #19088] * sysdeps/ieee754/dbl-64/s_lround.c: Include <fenv.h> and <limits.h>. (__lround) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Include <fenv.h> and <limits.h>. (__lround) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-128/s_llroundl.c: Include <fenv.h> and <limits.h>. (__llroundl) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-128/s_lroundl.c: Include <fenv.h> and <limits.h>. (__lroundl) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-96/s_llroundl.c: Include <fenv.h> and <limits.h>. (__llroundl) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * sysdeps/ieee754/ldbl-96/s_lroundl.c: Include <fenv.h> and <limits.h>. (__lroundl) [FE_INVALID]: Force FE_INVALID exception when result overflows but exception would not result from cast. * math/libm-test.inc (lround_test_data): Add more tests. (llround_test_data): Likewise.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/NEWS b/NEWS index 30284ba6a3..a3adcfdff8 100644 --- a/NEWS +++ b/NEWS @@ -18,7 +18,7 @@ Version 2.23 18820, 18823, 18824, 18825, 18857, 18863, 18870, 18872, 18873, 18875, 18887, 18921, 18951, 18952, 18956, 18961, 18966, 18967, 18969, 18970, 18977, 18980, 18981, 18985, 19003, 19012, 19016, 19018, 19032, 19046, - 19049, 19050, 19059, 19071, 19076, 19077, 19078, 19079, 19085. + 19049, 19050, 19059, 19071, 19076, 19077, 19078, 19079, 19085, 19088. * The obsolete header <regexp.h> has been removed. Programs that require this header must be updated to use <regex.h> instead. |