glibc/sysdeps
Joseph Myers 1272748886 Fix ldbl-128ibm lrintl, lroundl missing "invalid" exceptions (bug 22690).
The ldbl-128ibm implementations of lrintl and lroundl are missing
"invalid" exceptions for certain overflow cases when compiled with GCC
8.  The cause of this is after-the-fact integer overflow checks that
fail when the compiler optimizes on the basis of integer overflow
being undefined; GCC 8 must be able to detect new cases of
undefinedness here.

Failure: lrint (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_downward (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_towardzero (-0x80000001p0): Exception "Invalid operation" not set
Failure: lrint_upward (-0x80000001p0): Exception "Invalid operation" not set

Failure: lround (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_downward (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_towardzero (-0x80000001p0): Exception "Invalid operation" not set
Failure: lround_upward (-0x80000001p0): Exception "Invalid operation" not set

(Tested that these failures occur before the patch for powerpc
soft-float, but the issue applies in principle for hard-float as well,
whether or not the particular optimizations in fact occur there at
present.)

This patch fixes the bug by ensuring the additions / subtractions in
question cast arguments to unsigned long int, or use 1UL as a constant
argument, so that the arithmetic occurs in an unsigned type with the
result then converted back to a signed type.

Tested for powerpc (soft-float).

	[BZ #22690]
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c (__lrintl): Use unsigned
	long int for arguments of possibly overflowing addition or
	subtraction.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c (__lroundl): Likewise.
2018-01-10 00:02:35 +00:00
..
aarch64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
alpha alpha: Remove s_trunc{f} implementation (BZ#22666) 2018-01-04 17:49:17 -02:00
arm Update ARM libm-test-ulps. 2018-01-02 18:37:06 +00:00
generic Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
gnu hurd: Fix glob64 compatibility symbols 2018-01-06 22:28:36 +01:00
hppa Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
i386 i386: Regenerate libm-test-ulps for for gcc 7 on i686 2018-01-06 22:11:40 +01:00
ia64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
ieee754 Fix ldbl-128ibm lrintl, lroundl missing "invalid" exceptions (bug 22690). 2018-01-10 00:02:35 +00:00
init_array Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
m68k Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mach hurd: Use the new file_exec_paths RPC 2018-01-09 01:37:34 +01:00
microblaze Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
mips Update MIPS libm-test-ulps. 2018-01-02 21:55:15 +00:00
nios2 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
nptl Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
posix hurd: Fix pwritev* 2018-01-07 13:31:36 +01:00
powerpc Fix powerpc-nofpu remainderl wrong sign of zero result (bug 22688). 2018-01-09 23:14:45 +00:00
pthread Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
s390 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sh Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
sparc Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
tile Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
unix tst-ttyname: skip the test when /dev/ptmx is not available 2018-01-08 22:02:53 +00:00
wordsize-32 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
wordsize-64 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
x86 Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
x86_64 x86-64: Add sincosf with vector FMA 2018-01-08 08:04:40 -08:00