diff options
author | Mikael Pettersson <[email protected]> | 2016-04-17 20:02:28 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-04-26 10:28:22 +0200 |
commit | 0127f930e6aa2abc95ec4a95c9d5638d7e9bd512 (patch) | |
tree | 3629899b02f9eb9a1855ffcaa9a886f4a6d97cdd /erts/emulator/sys/unix | |
parent | 76cf34c49631845a21ffdd6d317d7fc944ab9b7b (diff) | |
download | otp-0127f930e6aa2abc95ec4a95c9d5638d7e9bd512.tar.gz otp-0127f930e6aa2abc95ec4a95c9d5638d7e9bd512.tar.bz2 otp-0127f930e6aa2abc95ec4a95c9d5638d7e9bd512.zip |
matherr() must not fake an FP exception
When FP exceptions are used, matherr() forces a fake FP exception,
which is interpreted as an error by the checking code after a math
routine call. This is wrong for several reasons:
- it's not necessary for error checking: when FP exceptions aren't
used, matherr() is a stub and no information is derived from it
being called
- it's not necessary for FPU maintenance: the FPU only needs to be
reprogrammed after an actual FP exception
- it causes false negatives: matherr() may be called even though
Erlang doesn't consider the case to be an error (exp() and pow()
underflows on Solaris for instance); with FP exceptions enabled
they are incorrectly considered errors
The fix is to remove all FP exception related code from matherr().
Diffstat (limited to 'erts/emulator/sys/unix')
-rw-r--r-- | erts/emulator/sys/unix/sys_float.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/erts/emulator/sys/unix/sys_float.c b/erts/emulator/sys/unix/sys_float.c index 60661d9016..9d2b25a787 100644 --- a/erts/emulator/sys/unix/sys_float.c +++ b/erts/emulator/sys/unix/sys_float.c @@ -818,11 +818,6 @@ sys_chars_to_double(char* buf, double* fp) int matherr(struct exception *exc) { -#if !defined(NO_FPE_SIGNALS) - volatile unsigned long *fpexnp = erts_get_current_fp_exception(); - if (fpexnp != NULL) - *fpexnp = (unsigned long)__builtin_return_address(0); -#endif return 1; } |