From 6c010c5dde1735f93cc3a6597cdcc2b482af85f8 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 6 Jul 2020 16:18:02 +0000 Subject: Use C2x return value from getpayload of non-NaN (bug 26073). In TS 18661-1, getpayload had an unspecified return value for a non-NaN argument, while C2x requires the return value -1 in that case. This patch implements the return value of -1. I don't think this is worth having a new symbol version that's an alias of the old one, although occasionally we do that in such cases where the new function semantics are a refinement of the old ones (to avoid programs relying on the new semantics running on older glibc versions but not behaving as intended). Tested for x86_64 and x86; also ran math/ tests for aarch64 and powerpc. --- sysdeps/ieee754/ldbl-128/s_getpayloadl.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sysdeps/ieee754/ldbl-128') diff --git a/sysdeps/ieee754/ldbl-128/s_getpayloadl.c b/sysdeps/ieee754/ldbl-128/s_getpayloadl.c index db55a00f66..1fbe704608 100644 --- a/sysdeps/ieee754/ldbl-128/s_getpayloadl.c +++ b/sysdeps/ieee754/ldbl-128/s_getpayloadl.c @@ -26,6 +26,9 @@ __getpayloadl (const _Float128 *x) { uint64_t hx, lx; GET_LDOUBLE_WORDS64 (hx, lx, *x); + if ((hx & 0x7fff000000000000ULL) != 0x7fff000000000000ULL + || ((hx & 0xffffffffffffULL) | lx) == 0) + return -1; hx &= 0x7fffffffffffULL; /* Construct the representation of the return value directly, since 128-bit integers may not be available. */ -- cgit 1.4.1