glibc/sysdeps
Alan Modra 4cf69995e2 Fix for [BZ #15680] IBM long double inaccuracy
http://sourceware.org/ml/libc-alpha/2013-06/msg00919.html

I discovered a number of places where denormals and other corner cases
were being handled wrongly.

- printf_fphex.c: Testing for the low double exponent being zero is
unnecessary.  If the difference in exponents is less than 53 then the
high double exponent must be nearing the low end of its range, and the
low double exponent hit rock bottom.

- ldbl2mpn.c: A denormal (ie. exponent of zero) value is treated as
if the exponent was one, so shift mantissa left by one.  Code handling
normalisation of the low double mantissa lacked a test for shift count
greater than bits in type being shifted, and lacked anything to handle
the case where the difference in exponents is less than 53 as in
printf_fphex.c.

- math_ldbl.h (ldbl_extract_mantissa): Same as above, but worse, with
code testing for exponent > 1 for some reason, probably a typo for >= 1.

- math_ldbl.h (ldbl_insert_mantissa): Round the high double as per
mpn2ldbl.c (hi is odd or explicit mantissas non-zero) so that the
number we return won't change when applying ldbl_canonicalize().
Add missing overflow checks and normalisation of high mantissa.
Correct misleading comment: "The hidden bit of the lo mantissa is
zero" is not always true as can be seen from the code rounding the hi
mantissa.  Also by inspection, lzcount can never be less than zero so
remove that test.  Lastly, masking bitfields to their widths can be
left to the compiler.

- mpn2ldbl.c: The overflow checks here on rounding of high double were
just plain wrong.  Incrementing the exponent must be accompanied by a
shift right of the mantissa to keep the value unchanged.  Above notes
for ldbl_insert_mantissa are also relevant.

	[BZ #15680]
	* sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c: Comment fix.
	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
	(PRINT_FPHEX_LONG_DOUBLE): Tidy code by moving -53 into ediff
	calculation.  Remove unnecessary test for denormal exponent.
	* sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c (__mpn_extract_long_double):
	Correct handling of denormals.  Avoid undefined shift behaviour.
	Correct normalisation of low mantissa when low double is denormal.
	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
	(ldbl_extract_mantissa): Likewise.  Comment.  Use uint64_t* for hi64.
	(ldbl_insert_mantissa): Make both hi64 and lo64 parms uint64_t.
	Correct normalisation of low mantissa.  Test for overflow of high
	mantissa and normalise.
	(ldbl_nearbyint): Use more readable constant for two52.
	* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
	(__mpn_construct_long_double): Fix test for overflow of high
	mantissa and correct normalisation.  Avoid undefined shift.
2013-10-04 10:30:56 +09:30
..
generic BZ #15754: Fix test case for ARM. 2013-09-23 01:44:38 -04:00
gnu Remove --disable-versioning. 2013-09-04 15:25:42 +00:00
i386 BZ #15754: CVE-2013-4788 2013-09-23 00:52:09 -04:00
ieee754 Fix for [BZ #15680] IBM long double inaccuracy 2013-10-04 10:30:56 +09:30
init_array Add sysdeps/init_array to produce empty crt[in].o and use .preinit_array for gcrt1.o 2013-03-12 12:50:13 -07:00
mach sysdeps/mach/hurd/i386/tls.h: Remove TLS_INIT_TP_EXPENSIVE. 2013-09-24 09:25:53 +01:00
posix Properly cache the result from looking up the nss database config 2013-09-30 10:29:13 +02:00
powerpc PowerPC: Fix POINTER_CHK_GUARD thread register for PPC64 2013-09-25 13:43:04 -05:00
pthread Fix typos. 2013-08-21 19:48:48 +02:00
s390 BZ #15754: CVE-2013-4788 2013-09-23 00:52:09 -04:00
sh Add SH implementation of stackguard-macros.h. 2013-09-27 10:59:02 +09:00
sparc BZ #15754: CVE-2013-4788 2013-09-23 00:52:09 -04:00
unix tst-fanotify: fix style 2013-09-28 23:53:50 -04:00
wordsize-32 Remove --disable-versioning. 2013-09-04 15:25:42 +00:00
wordsize-64 Move dummy glob64.c alongside glob.c that defines glob64. 2013-05-06 16:11:11 -07:00
x86 Fix typos. 2013-08-21 19:48:48 +02:00
x86_64 Faster strrchr. 2013-09-26 19:23:01 +02:00