arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-ppc64le-06.patch

147e83
# commit 1b6adf888de14675bc3207578dcb7132ed5f8ecc
147e83
# Author: Alan Modra <amodra@gmail.com>
147e83
# Date:   Sat Aug 17 18:21:58 2013 +0930
147e83
# 
147e83
#     PowerPC floating point little-endian [1 of 15]
147e83
#     http://sourceware.org/ml/libc-alpha/2013-08/msg00081.html
147e83
#     
147e83
#     This is the first of a series of patches to ban ieee854_long_double
147e83
#     and the ieee854_long_double macros when using IBM long double.  union
147e83
#     ieee854_long_double just isn't correct for IBM long double, especially
147e83
#     when little-endian, and pretending it is OK has allowed a number of
147e83
#     bugs to remain undetected in sysdeps/ieee754/ldbl-128ibm/.
147e83
#     
147e83
#     This changes the few places in generic code that use it.
147e83
#     
147e83
#         * stdio-common/printf_size.c (__printf_size): Don't use
147e83
#         union ieee854_long_double in fpnum union.
147e83
#         * stdio-common/printf_fphex.c (__printf_fphex): Likewise.  Use
147e83
#         signbit macro to retrieve sign from long double.
147e83
#         * stdio-common/printf_fp.c (___printf_fp): Use signbit macro to
147e83
#         retrieve sign from long double.
147e83
#         * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Adjust for fpnum change.
147e83
#         * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise.
147e83
#         * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise.
147e83
#         * sysdeps/x86_64/fpu/printf_fphex.c: Likewise.
147e83
#         * math/test-misc.c (main): Don't use union ieee854_long_double.
147e83
#     ports/
147e83
#         * sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change.
147e83
# 
147e83
diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-misc.c
147e83
--- glibc-2.17-c758a686/math/test-misc.c	2014-05-27 19:53:22.000000000 -0500
147e83
+++ glibc-2.17-c758a686/math/test-misc.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -721,300 +721,161 @@
147e83
 
147e83
 #ifndef NO_LONG_DOUBLE
147e83
   {
147e83
-    union ieee854_long_double v1;
147e83
-    union ieee854_long_double v2;
147e83
-    long double ld;
147e83
+    long double v1, v2;
147e83
 
147e83
-    v1.d = ld = LDBL_MIN;
147e83
-    if (fpclassify (ld) != FP_NORMAL)
147e83
+    v1 = LDBL_MIN;
147e83
+    if (fpclassify (v1) != FP_NORMAL)
147e83
       {
147e83
-	printf ("fpclassify (LDBL_MIN) failed: %d\n", fpclassify (ld));
147e83
+	printf ("fpclassify (LDBL_MIN) failed: %d (%La)\n",
147e83
+		fpclassify (v1), v1);
147e83
 	result = 1;
147e83
       }
147e83
-    ld = nextafterl (ld, LDBL_MIN / 2.0);
147e83
-    if (fpclassify (ld) != FP_SUBNORMAL)
147e83
+    v2 = nextafterl (v1, LDBL_MIN / 2.0);
147e83
+    if (fpclassify (v2) != FP_SUBNORMAL)
147e83
       {
147e83
 	printf ("fpclassify (LDBL_MIN-epsilon) failed: %d (%La)\n",
147e83
-		fpclassify (ld), ld);
147e83
+		fpclassify (v2), v2);
147e83
 	result = 1;
147e83
       }
147e83
-    v2.d = ld = nextafterl (ld, LDBL_MIN);
147e83
-    if (fpclassify (ld) != FP_NORMAL)
147e83
+    v2 = nextafterl (v2, LDBL_MIN);
147e83
+    if (fpclassify (v2) != FP_NORMAL)
147e83
       {
147e83
 	printf ("fpclassify (LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
147e83
-		fpclassify (ld), ld);
147e83
+		fpclassify (v2), v2);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
147e83
+    if (v1 != v2)
147e83
       {
147e83
-	printf ("LDBL_MIN: mantissa0 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa0, v2.ieee.mantissa0);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
147e83
-      {
147e83
-	printf ("LDBL_MIN: mantissa1 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa1, v2.ieee.mantissa1);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.exponent != v2.ieee.exponent)
147e83
-      {
147e83
-	printf ("LDBL_MIN: exponent differs: %4x vs %4x\n",
147e83
-		v1.ieee.exponent, v2.ieee.exponent);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.negative != v2.ieee.negative)
147e83
-      {
147e83
-	printf ("LDBL_MIN: negative differs: %d vs %d\n",
147e83
-		v1.ieee.negative, v2.ieee.negative);
147e83
+	printf ("LDBL_MIN-epsilon+epsilon != LDBL_MIN: %La vs %La\n", v2, v1);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    v1.d = ld = -LDBL_MIN;
147e83
-    if (fpclassify (ld) != FP_NORMAL)
147e83
+    v1 = -LDBL_MIN;
147e83
+    if (fpclassify (v1) != FP_NORMAL)
147e83
       {
147e83
-	printf ("fpclassify (-LDBL_MIN) failed: %d\n", fpclassify (ld));
147e83
+	printf ("fpclassify (-LDBL_MIN) failed: %d (%La)\n",
147e83
+		fpclassify (v1), v1);
147e83
 	result = 1;
147e83
       }
147e83
-    ld = nextafterl (ld, -LDBL_MIN / 2.0);
147e83
-    if (fpclassify (ld) != FP_SUBNORMAL)
147e83
+    v2 = nextafterl (v1, -LDBL_MIN / 2.0);
147e83
+    if (fpclassify (v2) != FP_SUBNORMAL)
147e83
       {
147e83
 	printf ("fpclassify (-LDBL_MIN-epsilon) failed: %d (%La)\n",
147e83
-		fpclassify (ld), ld);
147e83
+		fpclassify (v2), v2);
147e83
 	result = 1;
147e83
       }
147e83
-    v2.d = ld = nextafterl (ld, -LDBL_MIN);
147e83
-    if (fpclassify (ld) != FP_NORMAL)
147e83
+    v2 = nextafterl (v2, -LDBL_MIN);
147e83
+    if (fpclassify (v2) != FP_NORMAL)
147e83
       {
147e83
 	printf ("fpclassify (-LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
147e83
-		fpclassify (ld), ld);
147e83
+		fpclassify (v2), v2);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
147e83
+    if (v1 != v2)
147e83
       {
147e83
-	printf ("-LDBL_MIN: mantissa0 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa0, v2.ieee.mantissa0);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
147e83
-      {
147e83
-	printf ("-LDBL_MIN: mantissa1 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa1, v2.ieee.mantissa1);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.exponent != v2.ieee.exponent)
147e83
-      {
147e83
-	printf ("-LDBL_MIN: exponent differs: %4x vs %4x\n",
147e83
-		v1.ieee.exponent, v2.ieee.exponent);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.negative != v2.ieee.negative)
147e83
-      {
147e83
-	printf ("-LDBL_MIN: negative differs: %d vs %d\n",
147e83
-		v1.ieee.negative, v2.ieee.negative);
147e83
+	printf ("-LDBL_MIN-epsilon+epsilon != -LDBL_MIN: %La vs %La\n", v2, v1);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    ld = LDBL_MAX;
147e83
-    if (fpclassify (ld) != FP_NORMAL)
147e83
+    v1 = LDBL_MAX;
147e83
+    if (fpclassify (v1) != FP_NORMAL)
147e83
       {
147e83
-	printf ("fpclassify (LDBL_MAX) failed: %d\n", fpclassify (ld));
147e83
+	printf ("fpclassify (LDBL_MAX) failed: %d (%La)\n",
147e83
+		fpclassify (v1), v1);
147e83
 	result = 1;
147e83
       }
147e83
-    ld = nextafterl (ld, INFINITY);
147e83
-    if (fpclassify (ld) != FP_INFINITE)
147e83
+    v2 = nextafterl (v1, INFINITY);
147e83
+    if (fpclassify (v2) != FP_INFINITE)
147e83
       {
147e83
-	printf ("fpclassify (LDBL_MAX+epsilon) failed: %d\n", fpclassify (ld));
147e83
+	printf ("fpclassify (LDBL_MAX+epsilon) failed: %d (%La)\n",
147e83
+		fpclassify (v2), v2);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    ld = -LDBL_MAX;
147e83
-    if (fpclassify (ld) != FP_NORMAL)
147e83
+    v1 = -LDBL_MAX;
147e83
+    if (fpclassify (v1) != FP_NORMAL)
147e83
       {
147e83
-	printf ("fpclassify (-LDBL_MAX) failed: %d\n", fpclassify (ld));
147e83
+	printf ("fpclassify (-LDBL_MAX) failed: %d (%La)\n",
147e83
+		fpclassify (v1), v1);
147e83
 	result = 1;
147e83
       }
147e83
-    ld = nextafterl (ld, -INFINITY);
147e83
-    if (fpclassify (ld) != FP_INFINITE)
147e83
+    v2 = nextafterl (v1, -INFINITY);
147e83
+    if (fpclassify (v2) != FP_INFINITE)
147e83
       {
147e83
-	printf ("fpclassify (-LDBL_MAX-epsilon) failed: %d\n",
147e83
-		fpclassify (ld));
147e83
+	printf ("fpclassify (-LDBL_MAX-epsilon) failed: %d (%La)\n",
147e83
+		fpclassify (v2), v2);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    v1.d = ld = 0.0625;
147e83
-    ld = nextafterl (ld, 0.0);
147e83
-    v2.d = ld = nextafterl (ld, 1.0);
147e83
+    v1 = 0.0625;
147e83
+    v2 = nextafterl (v1, 0.0);
147e83
+    v2 = nextafterl (v2, 1.0);
147e83
 
147e83
-    if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
147e83
-      {
147e83
-	printf ("0.0625L down: mantissa0 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa0, v2.ieee.mantissa0);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
147e83
-      {
147e83
-	printf ("0.0625L down: mantissa1 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa1, v2.ieee.mantissa1);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.exponent != v2.ieee.exponent)
147e83
-      {
147e83
-	printf ("0.0625L down: exponent differs: %4x vs %4x\n",
147e83
-		v1.ieee.exponent, v2.ieee.exponent);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.negative != v2.ieee.negative)
147e83
+    if (v1 != v2)
147e83
       {
147e83
-	printf ("0.0625L down: negative differs: %d vs %d\n",
147e83
-		v1.ieee.negative, v2.ieee.negative);
147e83
+	printf ("0.0625L-epsilon+epsilon != 0.0625L: %La vs %La\n", v2, v1);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    v1.d = ld = 0.0625;
147e83
-    ld = nextafterl (ld, 1.0);
147e83
-    v2.d = ld = nextafterl (ld, 0.0);
147e83
+    v1 = 0.0625;
147e83
+    v2 = nextafterl (v1, 1.0);
147e83
+    v2 = nextafterl (v2, 0.0);
147e83
 
147e83
-    if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
147e83
-      {
147e83
-	printf ("0.0625L up: mantissa0 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa0, v2.ieee.mantissa0);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
147e83
-      {
147e83
-	printf ("0.0625L up: mantissa1 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa1, v2.ieee.mantissa1);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.exponent != v2.ieee.exponent)
147e83
+    if (v1 != v2)
147e83
       {
147e83
-	printf ("0.0625L up: exponent differs: %4x vs %4x\n",
147e83
-		v1.ieee.exponent, v2.ieee.exponent);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.negative != v2.ieee.negative)
147e83
-      {
147e83
-	printf ("0.0625L up: negative differs: %d vs %d\n",
147e83
-		v1.ieee.negative, v2.ieee.negative);
147e83
+	printf ("0.0625L+epsilon-epsilon != 0.0625L: %La vs %La\n", v2, v1);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    v1.d = ld = -0.0625;
147e83
-    ld = nextafterl (ld, 0.0);
147e83
-    v2.d = ld = nextafterl (ld, -1.0);
147e83
+    v1 = -0.0625;
147e83
+    v2 = nextafterl (v1, 0.0);
147e83
+    v2 = nextafterl (v2, -1.0);
147e83
 
147e83
-    if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
147e83
-      {
147e83
-	printf ("-0.0625L up: mantissa0 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa0, v2.ieee.mantissa0);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
147e83
-      {
147e83
-	printf ("-0.0625L up: mantissa1 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa1, v2.ieee.mantissa1);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.exponent != v2.ieee.exponent)
147e83
+    if (v1 != v2)
147e83
       {
147e83
-	printf ("-0.0625L up: exponent differs: %4x vs %4x\n",
147e83
-		v1.ieee.exponent, v2.ieee.exponent);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.negative != v2.ieee.negative)
147e83
-      {
147e83
-	printf ("-0.0625L up: negative differs: %d vs %d\n",
147e83
-		v1.ieee.negative, v2.ieee.negative);
147e83
+	printf ("-0.0625L+epsilon-epsilon != -0.0625L: %La vs %La\n", v2, v1);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    v1.d = ld = -0.0625;
147e83
-    ld = nextafterl (ld, -1.0);
147e83
-    v2.d = ld = nextafterl (ld, 0.0);
147e83
+    v1 = -0.0625;
147e83
+    v2 = nextafterl (v1, -1.0);
147e83
+    v2 = nextafterl (v2, 0.0);
147e83
 
147e83
-    if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
147e83
-      {
147e83
-	printf ("-0.0625L down: mantissa0 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa0, v2.ieee.mantissa0);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
147e83
+    if (v1 != v2)
147e83
       {
147e83
-	printf ("-0.0625L down: mantissa1 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa1, v2.ieee.mantissa1);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.exponent != v2.ieee.exponent)
147e83
-      {
147e83
-	printf ("-0.0625L down: exponent differs: %4x vs %4x\n",
147e83
-		v1.ieee.exponent, v2.ieee.exponent);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.negative != v2.ieee.negative)
147e83
-      {
147e83
-	printf ("-0.0625L down: negative differs: %d vs %d\n",
147e83
-		v1.ieee.negative, v2.ieee.negative);
147e83
+	printf ("-0.0625L-epsilon+epsilon != -0.0625L: %La vs %La\n", v2, v1);
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    v1.d = ld = 0.0;
147e83
-    ld = nextafterl (ld, 1.0);
147e83
-    v2.d = nextafterl (ld, -1.0);
147e83
+    v1 = 0.0;
147e83
+    v2 = nextafterl (v1, 1.0);
147e83
+    v2 = nextafterl (v2, -1.0);
147e83
 
147e83
-    if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
147e83
-      {
147e83
-	printf ("0.0L up: mantissa0 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa0, v2.ieee.mantissa0);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
147e83
-      {
147e83
-	printf ("0.0L up: mantissa1 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa1, v2.ieee.mantissa1);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.exponent != v2.ieee.exponent)
147e83
+    if (v1 != v2)
147e83
       {
147e83
-	printf ("0.0L up: exponent differs: %4x vs %4x\n",
147e83
-		v1.ieee.exponent, v2.ieee.exponent);
147e83
+	printf ("0.0+epsilon-epsilon != 0.0L: %La vs %La\n", v2, v1);
147e83
 	result = 1;
147e83
       }
147e83
-    if (0 != v2.ieee.negative)
147e83
+    if (signbit (v2))
147e83
       {
147e83
-	printf ("0.0L up: negative differs: 0 vs %d\n",
147e83
-		v2.ieee.negative);
147e83
+	printf ("0.0+epsilon-epsilon is negative\n");
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
-    v1.d = ld = 0.0;
147e83
-    ld = nextafterl (ld, -1.0);
147e83
-    v2.d = nextafterl (ld, 1.0);
147e83
+    v1 = 0.0;
147e83
+    v2 = nextafterl (v1, -1.0);
147e83
+    v2 = nextafterl (v2, 1.0);
147e83
 
147e83
-    if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
147e83
-      {
147e83
-	printf ("0.0L down: mantissa0 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa0, v2.ieee.mantissa0);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.mantissa1 != v2.ieee.mantissa1)
147e83
-      {
147e83
-	printf ("0.0L down: mantissa1 differs: %8x vs %8x\n",
147e83
-		v1.ieee.mantissa1, v2.ieee.mantissa1);
147e83
-	result = 1;
147e83
-      }
147e83
-    if (v1.ieee.exponent != v2.ieee.exponent)
147e83
+    if (v1 != v2)
147e83
       {
147e83
-	printf ("0.0L down: exponent differs: %4x vs %4x\n",
147e83
-		v1.ieee.exponent, v2.ieee.exponent);
147e83
+	printf ("0.0-epsilon+epsilon != 0.0L: %La vs %La\n", v2, v1);
147e83
 	result = 1;
147e83
       }
147e83
-    if (1 != v2.ieee.negative)
147e83
+    if (!signbit (v2))
147e83
       {
147e83
-	printf ("0.0L down: negative differs: 1 vs %d\n",
147e83
-		v2.ieee.negative);
147e83
+	printf ("0.0-epsilon+epsilon is positive\n");
147e83
 	result = 1;
147e83
       }
147e83
 
147e83
diff -urN glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c
147e83
--- glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c	2014-05-27 19:53:21.000000000 -0500
147e83
+++ glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -25,9 +25,11 @@
147e83
       /* The "strange" 80 bit format on ia64 has an explicit		      \
147e83
 	 leading digit in the 64 bit mantissa.  */			      \
147e83
       unsigned long long int num;					      \
147e83
+      union ieee854_long_double u;					      \
147e83
+      u.d = fpnum.ldbl;							      \
147e83
 									      \
147e83
-      num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32	      \
147e83
-	     | fpnum.ldbl.ieee.mantissa1);				      \
147e83
+      num = (((unsigned long long int) u.ieee.mantissa0) << 32		      \
147e83
+	     | u.ieee.mantissa1);					      \
147e83
 									      \
147e83
       zero_mantissa = num == 0;						      \
147e83
 									      \
147e83
@@ -49,8 +51,8 @@
147e83
 									      \
147e83
       /* We have 3 bits from the mantissa in the leading nibble.	      \
147e83
 	 Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'.  */      \
147e83
-      exponent = fpnum.ldbl.ieee.exponent;				      \
147e83
-									     \
147e83
+      exponent = u.ieee.exponent;					      \
147e83
+									      \
147e83
       if (exponent == 0)						      \
147e83
 	{								      \
147e83
 	  if (zero_mantissa)						      \
147e83
diff -urN glibc-2.17-c758a686/stdio-common/printf_fp.c glibc-2.17-c758a686/stdio-common/printf_fp.c
147e83
--- glibc-2.17-c758a686/stdio-common/printf_fp.c	2014-05-27 19:53:22.000000000 -0500
147e83
+++ glibc-2.17-c758a686/stdio-common/printf_fp.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -335,8 +335,7 @@
147e83
       int res;
147e83
       if (__isnanl (fpnum.ldbl))
147e83
 	{
147e83
-	  union ieee854_long_double u = { .d = fpnum.ldbl };
147e83
-	  is_neg = u.ieee.negative != 0;
147e83
+	  is_neg = signbit (fpnum.ldbl);
147e83
 	  if (isupper (info->spec))
147e83
 	    {
147e83
 	      special = "NAN";
147e83
diff -urN glibc-2.17-c758a686/stdio-common/printf_fphex.c glibc-2.17-c758a686/stdio-common/printf_fphex.c
147e83
--- glibc-2.17-c758a686/stdio-common/printf_fphex.c	2014-05-27 19:53:22.000000000 -0500
147e83
+++ glibc-2.17-c758a686/stdio-common/printf_fphex.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -93,7 +93,7 @@
147e83
   union
147e83
     {
147e83
       union ieee754_double dbl;
147e83
-      union ieee854_long_double ldbl;
147e83
+      long double ldbl;
147e83
     }
147e83
   fpnum;
147e83
 
147e83
@@ -162,12 +162,11 @@
147e83
 #ifndef __NO_LONG_DOUBLE_MATH
147e83
   if (info->is_long_double && sizeof (long double) > sizeof (double))
147e83
     {
147e83
-      fpnum.ldbl.d = *(const long double *) args[0];
147e83
+      fpnum.ldbl = *(const long double *) args[0];
147e83
 
147e83
       /* Check for special values: not a number or infinity.  */
147e83
-      if (__isnanl (fpnum.ldbl.d))
147e83
+      if (__isnanl (fpnum.ldbl))
147e83
 	{
147e83
-	  negative = fpnum.ldbl.ieee.negative != 0;
147e83
 	  if (isupper (info->spec))
147e83
 	    {
147e83
 	      special = "NAN";
147e83
@@ -181,8 +180,7 @@
147e83
 	}
147e83
       else
147e83
 	{
147e83
-	  int res = __isinfl (fpnum.ldbl.d);
147e83
-	  if (res)
147e83
+	  if (__isinfl (fpnum.ldbl))
147e83
 	    {
147e83
 	      if (isupper (info->spec))
147e83
 		{
147e83
@@ -194,11 +192,9 @@
147e83
 		  special = "inf";
147e83
 		  wspecial = L"inf";
147e83
 		}
147e83
-	      negative = res < 0;
147e83
 	    }
147e83
-	  else
147e83
-	    negative = signbit (fpnum.ldbl.d);
147e83
 	}
147e83
+      negative = signbit (fpnum.ldbl);
147e83
     }
147e83
   else
147e83
 #endif	/* no long double */
147e83
diff -urN glibc-2.17-c758a686/stdio-common/printf_size.c glibc-2.17-c758a686/stdio-common/printf_size.c
147e83
--- glibc-2.17-c758a686/stdio-common/printf_size.c	2014-05-27 19:53:22.000000000 -0500
147e83
+++ glibc-2.17-c758a686/stdio-common/printf_size.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -103,7 +103,7 @@
147e83
   union
147e83
     {
147e83
       union ieee754_double dbl;
147e83
-      union ieee854_long_double ldbl;
147e83
+      long double ldbl;
147e83
     }
147e83
   fpnum;
147e83
   const void *ptr = &fpnum;
147e83
@@ -123,25 +123,25 @@
147e83
 #ifndef __NO_LONG_DOUBLE_MATH
147e83
   if (info->is_long_double && sizeof (long double) > sizeof (double))
147e83
     {
147e83
-      fpnum.ldbl.d = *(const long double *) args[0];
147e83
+      fpnum.ldbl = *(const long double *) args[0];
147e83
 
147e83
       /* Check for special values: not a number or infinity.  */
147e83
-      if (__isnanl (fpnum.ldbl.d))
147e83
+      if (__isnanl (fpnum.ldbl))
147e83
 	{
147e83
 	  special = "nan";
147e83
 	  wspecial = L"nan";
147e83
 	  // fpnum_sign = 0;	Already zero
147e83
 	}
147e83
-      else if ((res = __isinfl (fpnum.ldbl.d)))
147e83
+      else if ((res = __isinfl (fpnum.ldbl)))
147e83
 	{
147e83
 	  fpnum_sign = res;
147e83
 	  special = "inf";
147e83
 	  wspecial = L"inf";
147e83
 	}
147e83
       else
147e83
-	while (fpnum.ldbl.d >= divisor && tag[1] != '\0')
147e83
+	while (fpnum.ldbl >= divisor && tag[1] != '\0')
147e83
 	  {
147e83
-	    fpnum.ldbl.d /= divisor;
147e83
+	    fpnum.ldbl /= divisor;
147e83
 	    ++tag;
147e83
 	  }
147e83
     }
147e83
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c
147e83
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c	2014-05-27 19:53:20.000000000 -0500
147e83
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -24,13 +24,15 @@
147e83
 	 digits we use only the implicit digits for the number before	      \
147e83
 	 the decimal point.  */						      \
147e83
       unsigned long long int num0, num1;				      \
147e83
+      union ieee854_long_double u;					      \
147e83
+      u.d = fpnum.ldbl;							      \
147e83
 									      \
147e83
       assert (sizeof (long double) == 16);				      \
147e83
 									      \
147e83
-      num0 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32      \
147e83
-	     | fpnum.ldbl.ieee.mantissa1);				      \
147e83
-      num1 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa2) << 32      \
147e83
-	     | fpnum.ldbl.ieee.mantissa3);				      \
147e83
+      num0 = (((unsigned long long int) u.ieee.mantissa0) << 32		      \
147e83
+	     | u.ieee.mantissa1);					      \
147e83
+      num1 = (((unsigned long long int) u.ieee.mantissa2) << 32		      \
147e83
+	     | u.ieee.mantissa3);					      \
147e83
 									      \
147e83
       zero_mantissa = (num0|num1) == 0;					      \
147e83
 									      \
147e83
@@ -75,9 +77,9 @@
147e83
 	  *--wnumstr = L'0';						      \
147e83
 	}								      \
147e83
 									      \
147e83
-      leading = fpnum.ldbl.ieee.exponent == 0 ? '0' : '1';		      \
147e83
+      leading = u.ieee.exponent == 0 ? '0' : '1';			      \
147e83
 									      \
147e83
-      exponent = fpnum.ldbl.ieee.exponent;				      \
147e83
+      exponent = u.ieee.exponent;					      \
147e83
 									      \
147e83
       if (exponent == 0)						      \
147e83
 	{								      \
147e83
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
147e83
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c	2014-05-27 19:53:20.000000000 -0500
147e83
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -28,14 +28,14 @@
147e83
       unsigned long long hi, lo;					      \
147e83
       int ediff;							      \
147e83
       union ibm_extended_long_double u;					      \
147e83
-      u.ld = fpnum.ldbl.d;						      \
147e83
+      u.ld = fpnum.ldbl;						      \
147e83
 									      \
147e83
       assert (sizeof (long double) == 16);				      \
147e83
 									      \
147e83
       lo = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;  \
147e83
       hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;  \
147e83
       lo <<= 7; /* pre-shift lo to match ieee854.  */			      \
147e83
-      /* If the lower double is not a denomal or zero then set the hidden     \
147e83
+      /* If the lower double is not a denormal or zero then set the hidden    \
147e83
 	 53rd bit.  */							      \
147e83
       if (u.d[1].ieee.exponent != 0)					      \
147e83
 	lo |= (1ULL << (52 + 7));					      \
147e83
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c
147e83
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c	2014-05-27 19:53:20.000000000 -0500
147e83
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -25,11 +25,13 @@
147e83
       /* The "strange" 80 bit format on ix86 and m68k has an explicit	      \
147e83
 	 leading digit in the 64 bit mantissa.  */			      \
147e83
       unsigned long long int num;					      \
147e83
+      union ieee854_long_double u;					      \
147e83
+      u.d = fpnum.ldbl;							      \
147e83
 									      \
147e83
       assert (sizeof (long double) == 12);				      \
147e83
 									      \
147e83
-      num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32	      \
147e83
-	     | fpnum.ldbl.ieee.mantissa1);				      \
147e83
+      num = (((unsigned long long int) u.ieee.mantissa0) << 32		      \
147e83
+	     | u.ieee.mantissa1);					      \
147e83
 									      \
147e83
       zero_mantissa = num == 0;						      \
147e83
 									      \
147e83
@@ -62,7 +64,7 @@
147e83
 									      \
147e83
       /* We have 3 bits from the mantissa in the leading nibble.	      \
147e83
 	 Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'.  */      \
147e83
-      exponent = fpnum.ldbl.ieee.exponent;				      \
147e83
+      exponent = u.ieee.exponent;					      \
147e83
 									      \
147e83
       if (exponent == 0)						      \
147e83
 	{								      \
147e83
diff -urN glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c
147e83
--- glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c	2014-05-27 19:53:20.000000000 -0500
147e83
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c	2014-05-27 19:53:45.000000000 -0500
147e83
@@ -25,10 +25,11 @@
147e83
       /* The "strange" 80 bit format on ix86 and m68k has an explicit	      \
147e83
 	 leading digit in the 64 bit mantissa.  */			      \
147e83
       unsigned long long int num;					      \
147e83
+      union ieee854_long_double u;					      \
147e83
+      u.d = fpnum.ldbl;							      \
147e83
 									      \
147e83
-									      \
147e83
-      num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32	      \
147e83
-	     | fpnum.ldbl.ieee.mantissa1);				      \
147e83
+      num = (((unsigned long long int) u.ieee.mantissa0) << 32		      \
147e83
+	     | u.ieee.mantissa1);					      \
147e83
 									      \
147e83
       zero_mantissa = num == 0;						      \
147e83
 									      \
147e83
@@ -61,7 +62,7 @@
147e83
 									      \
147e83
       /* We have 3 bits from the mantissa in the leading nibble.	      \
147e83
 	 Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'.  */      \
147e83
-      exponent = fpnum.ldbl.ieee.exponent;				      \
147e83
+      exponent = u.ieee.exponent;					      \
147e83
 									      \
147e83
       if (exponent == 0)						      \
147e83
 	{								      \