aboutsummaryrefslogtreecommitdiff
path: root/posix/execvpe.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-09-28 01:59:02 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-09-28 01:59:02 +0000
commitf124cb381116b5809de198327690ad0bd8d1478e (patch)
tree9366d5952d3f1730b45bf757b257bff5ad260837 /posix/execvpe.c
parent7edd06916d0f18714f323b180b890f1fea39e1ff (diff)
downloadglibc-f124cb381116b5809de198327690ad0bd8d1478e.tar
glibc-f124cb381116b5809de198327690ad0bd8d1478e.tar.gz
glibc-f124cb381116b5809de198327690ad0bd8d1478e.tar.bz2
glibc-f124cb381116b5809de198327690ad0bd8d1478e.zip
Fix nearbyint arithmetic moved before feholdexcept (bug 22225).
In <https://sourceware.org/ml/libc-alpha/2013-05/msg00722.html> I remarked on the possibility of arithmetic in various nearbyint implementations being scheduled before feholdexcept calls, resulting in spurious "inexact" exceptions. I'm now actually observing this occurring in glibc built for ARM with GCC 7 (in fact, both copies of the same addition/subtraction sequence being combined and moved out before the conditionals and feholdexcept/fesetenv pairs), resulting in test failures. This patch makes the nearbyint implementations with this particular feholdexcept / arithmetic / fesetenv pattern consistently use math_opt_barrier on the function argument when first used in arithmetic, and also consistently use math_force_eval before fesetenv (the latter was generally already done, but the dbl-64/wordsize-64 implementation used math_opt_barrier instead, and as math_opt_barrier's intended effect is through its output value being used, such a use that doesn't use the return value is suspect). Tested for x86_64 (--disable-multi-arch so more of these implementations get used), and for ARM in a configuration where I saw the problem scheduling. [BZ #22225] * sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use math_opt_barrier on argument when doing arithmetic on it. * sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c (__nearbyint): Likewise. Use math_force_eval not math_opt_barrier after arithmetic. * sysdeps/ieee754/flt-32/s_nearbyintf.c (__nearbyintf): Use math_opt_barrier on argument when doing arithmetic on it. * sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl): Likewise.
Diffstat (limited to 'posix/execvpe.c')
0 files changed, 0 insertions, 0 deletions