From e334b681182e7a354db0e66caa41abe1e1bbcec5 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Sun, 3 Aug 2014 22:16:22 -0700
Subject: [PATCH] Fix aliasing issue noted by gcc 4.4.1 on Linux.

I think the offending code in each case is trying to extract the low
word if x. I think it works because on a little-endian machine,
*(unsigned*)&one is 0 since the low word is stored first. On a
big-endian machine, *(unsigned*)&one is the high word which, when
right shifted by 29, gives 1.  That is added to the address of x to
get the low word of x.
---
 src/lisp/e_cosh.c | 4 ++++
 src/lisp/e_sinh.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/lisp/e_cosh.c b/src/lisp/e_cosh.c
index f022ec040..28b6c3c4f 100644
--- a/src/lisp/e_cosh.c
+++ b/src/lisp/e_cosh.c
@@ -78,7 +78,11 @@ static double one = 1.0, half=0.5, huge = 1.0e300;
 	if (ix < 0x40862E42)  return half*__ieee754_exp(fabs(x));
 
     /* |x| in [log(maxdouble), overflowthresold] */
+#if 0
 	lx = *( (((*(unsigned*)&one)>>29)) + (unsigned*)&x);
+#else
+        lx = ux.i[LOWORD];
+#endif
 	if (ix<0x408633CE || 
 	      ((ix==0x408633ce)&&(lx<=(unsigned)0x8fb9f87d))) {
 	    w = __ieee754_exp(half*fabs(x));
diff --git a/src/lisp/e_sinh.c b/src/lisp/e_sinh.c
index 84447418a..76b3418d0 100644
--- a/src/lisp/e_sinh.c
+++ b/src/lisp/e_sinh.c
@@ -72,7 +72,11 @@ static double one = 1.0, shuge = 1.0e307;
 	if (ix < 0x40862E42)  return h*__ieee754_exp(fabs(x));
 
     /* |x| in [log(maxdouble), overflowthresold] */
+#if 0
 	lx = *( (((*(unsigned*)&one)>>29)) + (unsigned*)&x);
+#else
+        lx = ux.i[LOWORD];
+#endif
 	if (ix<0x408633CE || ((ix==0x408633ce)&&(lx<=(unsigned)0x8fb9f87d))) {
 	    w = __ieee754_exp(0.5*fabs(x));
 	    t = h*w;
-- 
GitLab