From 846d9a4a3acdb4939ca7bf6aed48f9f6f26911be Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 22 Oct 2015 23:14:55 +0000 Subject: Fix i386 / x86_64 nearbyint exception clearing (bug 15491). The implementations of nearbyint functions using x87 floating point (i386 all versions, x86_64 long double only) use the fclex instruction, which clears any exceptions that were raised before the function was called. These functions must not clear exceptions that were raised before they were called. This patch fixes these functions to save and restore the whole floating-point environment (fnstenv / fldenv) as the way of avoiding raising "inexact" (recall that there isn't an x87 instruction for loading just the status word, so the whole environment has to be saved and loaded instead - the code already saved and loaded the control word, which is now obtained from the saved environment after this patch, to disable traps on "inexact"). In the case of the long double functions, any "invalid" exception from frndint (applied to a signaling NaN) needs merging into the saved state; this issue doesn't apply to the float and double functions because that exception would have been raised when the argument is loaded, before the environment is saved. [BZ #15491] * sysdeps/i386/fpu/s_nearbyint.S (__nearbyint): Save and restore floating-point environment instead of clearing all exceptions. * sysdeps/i386/fpu/s_nearbyintf.S (__nearbyintf): Likewise. * sysdeps/i386/fpu/s_nearbyintl.S (__nearbyintl): Likewise, merging in "invalid" exceptions from frndint. * sysdeps/x86_64/fpu/s_nearbyintl.S (__nearbyintl): Likewise. * math/test-nearbyint-except.c: New file. * math/Makefile (tests): Add test-nearbyint-except. --- NEWS | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 00e3b03e5e..77534b941c 100644 --- a/NEWS +++ b/NEWS @@ -10,18 +10,18 @@ Version 2.23 * The following bugs are resolved with this release: 887, 2542, 2543, 2558, 2898, 4404, 6803, 10432, 14341, 14912, 15367, - 15384, 15470, 15786, 15918, 16141, 16296, 16347, 16399, 16415, 16422, - 16517, 16519, 16520, 16521, 16620, 16734, 16973, 16985, 17118, 17243, - 17244, 17250, 17441, 17787, 17886, 17887, 17905, 18084, 18086, 18240, - 18265, 18370, 18421, 18480, 18525, 18595, 18589, 18610, 18618, 18647, - 18661, 18674, 18675, 18681, 18699, 18724, 18743, 18757, 18778, 18781, - 18787, 18789, 18790, 18795, 18796, 18803, 18820, 18823, 18824, 18825, - 18857, 18863, 18870, 18872, 18873, 18875, 18887, 18918, 18921, 18928, - 18951, 18952, 18953, 18956, 18961, 18966, 18967, 18969, 18970, 18977, - 18980, 18981, 18982, 18985, 19003, 19007, 19012, 19016, 19018, 19032, - 19046, 19049, 19050, 19059, 19071, 19074, 19076, 19077, 19078, 19079, - 19085, 19086, 19088, 19094, 19095, 19124, 19125, 19129, 19134, 19137, - 19156. + 15384, 15470, 15491, 15786, 15918, 16141, 16296, 16347, 16399, 16415, + 16422, 16517, 16519, 16520, 16521, 16620, 16734, 16973, 16985, 17118, + 17243, 17244, 17250, 17441, 17787, 17886, 17887, 17905, 18084, 18086, + 18240, 18265, 18370, 18421, 18480, 18525, 18595, 18589, 18610, 18618, + 18647, 18661, 18674, 18675, 18681, 18699, 18724, 18743, 18757, 18778, + 18781, 18787, 18789, 18790, 18795, 18796, 18803, 18820, 18823, 18824, + 18825, 18857, 18863, 18870, 18872, 18873, 18875, 18887, 18918, 18921, + 18928, 18951, 18952, 18953, 18956, 18961, 18966, 18967, 18969, 18970, + 18977, 18980, 18981, 18982, 18985, 19003, 19007, 19012, 19016, 19018, + 19032, 19046, 19049, 19050, 19059, 19071, 19074, 19076, 19077, 19078, + 19079, 19085, 19086, 19088, 19094, 19095, 19124, 19125, 19129, 19134, + 19137, 19156. * There is now a --disable-timezone-tools configure option for disabling the building and installing of the timezone related utilities (zic, zdump, and -- cgit v1.2.3