From 1b6adf888de14675bc3207578dcb7132ed5f8ecc Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 17 Aug 2013 18:21:58 +0930 Subject: PowerPC floating point little-endian [1 of 15] http://sourceware.org/ml/libc-alpha/2013-08/msg00081.html This is the first of a series of patches to ban ieee854_long_double and the ieee854_long_double macros when using IBM long double. union ieee854_long_double just isn't correct for IBM long double, especially when little-endian, and pretending it is OK has allowed a number of bugs to remain undetected in sysdeps/ieee754/ldbl-128ibm/. This changes the few places in generic code that use it. * stdio-common/printf_size.c (__printf_size): Don't use union ieee854_long_double in fpnum union. * stdio-common/printf_fphex.c (__printf_fphex): Likewise. Use signbit macro to retrieve sign from long double. * stdio-common/printf_fp.c (___printf_fp): Use signbit macro to retrieve sign from long double. * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Adjust for fpnum change. * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise. * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise. * sysdeps/x86_64/fpu/printf_fphex.c: Likewise. * math/test-misc.c (main): Don't use union ieee854_long_double. ports/ * sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change. --- sysdeps/ieee754/ldbl-128ibm/printf_fphex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sysdeps/ieee754/ldbl-128ibm/printf_fphex.c') diff --git a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c index 453c2be..e0ec422 100644 --- a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c @@ -27,14 +27,14 @@ do { \ unsigned long long hi, lo; \ int ediff; \ union ibm_extended_long_double u; \ - u.ld = fpnum.ldbl.d; \ + u.ld = fpnum.ldbl; \ \ assert (sizeof (long double) == 16); \ \ lo = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; \ hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; \ lo <<= 7; /* pre-shift lo to match ieee854. */ \ - /* If the lower double is not a denomal or zero then set the hidden \ + /* If the lower double is not a denormal or zero then set the hidden \ 53rd bit. */ \ if (u.d[1].ieee.exponent != 0) \ lo |= (1ULL << (52 + 7)); \ -- cgit v1.1