diff options
author | Joseph Myers <joseph@codesourcery.com> | 2015-11-13 12:03:46 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2015-11-13 12:03:46 +0000 |
commit | 909f8e14dbe4073d75a776b4a9f50e5cc450f161 (patch) | |
tree | 18700b3f961d37bdec7b9080852691bf3fe97e83 /sysdeps/ieee754/ldbl-128ibm/Makefile | |
parent | 21378ae0d390c45ef382e8c95cc3593845ebb6ea (diff) | |
download | glibc-909f8e14dbe4073d75a776b4a9f50e5cc450f161.zip glibc-909f8e14dbe4073d75a776b4a9f50e5cc450f161.tar.gz glibc-909f8e14dbe4073d75a776b4a9f50e5cc450f161.tar.bz2 |
Fix ldbl-128ibm strtold overflow handling (bug 14551).
For ldbl-128ibm, if the result of strtold overflows in the final
conversion from MPN to IBM long double (because the exponent for a
106-bit IEEE result is 1023 but the high part would end up as
0x1p1024, which overflows), that conversion code fails to handle this
and produces an invalid long double value (high part infinite, low
part not zero) without raising exceptions or setting errno. This
patch adds an explicit check for this case to ensure an appropriate
result is returned in a way that ensures the right exceptions are
raised, with errno set.
Tested for powerpc.
[BZ #14551]
* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Include <errno.h>.
(__mpn_construct_long_double): If high part overflows to infinity,
set errno and recompute overflowed result of the correct sign.
* sysdeps/ieee754/ldbl-128ibm/Makefile
[$(subdir) = stdlib] (tests): Add tst-strtold-ldbl-128ibm.
[$(subdir) = stdlib] ($(objpfx)tst-strtold-ldbl-128ibm): Depend on
$(libm).
* sysdeps/ieee754/ldbl-128ibm/tst-strtold-ldbl-128ibm.c: New file.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/Makefile')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/Makefile | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/Makefile b/sysdeps/ieee754/ldbl-128ibm/Makefile index 8e1e2e6..5591814 100644 --- a/sysdeps/ieee754/ldbl-128ibm/Makefile +++ b/sysdeps/ieee754/ldbl-128ibm/Makefile @@ -3,3 +3,8 @@ # when -mlong-double-64 is not used). long-double-fcts = yes sysdep-CFLAGS += -mlong-double-128 + +ifeq ($(subdir),stdlib) +tests += tst-strtold-ldbl-128ibm +$(objpfx)tst-strtold-ldbl-128ibm: $(libm) +endif |