real.c (GET_REAL): Don't violate ANSI/ISO aliasing rules.
authorMark Mitchell <mark@codesourcery.com>
Thu, 5 Aug 1999 05:41:34 +0000 (05:41 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 5 Aug 1999 05:41:34 +0000 (23:41 -0600)
        * real.c (GET_REAL): Don't violate ANSI/ISO aliasing rules.
        (PUT_REAL): Likewise.

From-SVN: r28521

gcc/ChangeLog
gcc/real.c

index 07d6b585a2ac51ca1c9d797b6c058c7ec97fcee5..fee7376c39b624892b7e4ae4d271c8deafff2eab 100644 (file)
@@ -1,3 +1,8 @@
+Wed Aug  4 23:39:20 1999  Mark Mitchell  <mark@codesourcery.com>
+
+       * real.c (GET_REAL): Don't violate ANSI/ISO aliasing rules.
+       (PUT_REAL): Likewise.
+
 Wed Aug  4 20:45:04 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * final.c (shorten_branches): Don't add an alignment for loops
index a077213309c8b611bef2fbf7379c7814d2369e2e..6594bd8c1f3323a0bdbb00d04800122b7d3b8493 100644 (file)
@@ -274,34 +274,34 @@ do {                                              \
 /* Emulator uses target format internally
    but host stores it in host endian-ness.  */
 
-#define GET_REAL(r,e)                                          \
-do {                                                           \
-     if (HOST_FLOAT_WORDS_BIG_ENDIAN == REAL_WORDS_BIG_ENDIAN) \
-       e53toe ((unsigned EMUSHORT *) (r), (e));                        \
-     else                                                      \
-       {                                                       \
-        unsigned EMUSHORT w[4];                                \
-        w[3] = ((EMUSHORT *) r)[0];                            \
-        w[2] = ((EMUSHORT *) r)[1];                            \
-        w[1] = ((EMUSHORT *) r)[2];                            \
-        w[0] = ((EMUSHORT *) r)[3];                            \
-        e53toe (w, (e));                                       \
-       }                                                       \
+#define GET_REAL(r,e)                                                  \
+do {                                                                   \
+     if (HOST_FLOAT_WORDS_BIG_ENDIAN == REAL_WORDS_BIG_ENDIAN)         \
+       e53toe ((unsigned EMUSHORT *) (r), (e));                                \
+     else                                                              \
+       {                                                               \
+        unsigned EMUSHORT w[4];                                        \
+         bcopy (((EMUSHORT *) r), &w[3], sizeof (EMUSHORT));           \
+         bcopy (((EMUSHORT *) r) + 1, &w[2], sizeof (EMUSHORT));       \
+        bcopy (((EMUSHORT *) r) + 2, &w[1], sizeof (EMUSHORT));        \
+        bcopy (((EMUSHORT *) r) + 3, &w[0], sizeof (EMUSHORT));        \
+        e53toe (w, (e));                                               \
+       }                                                               \
    } while (0)
 
-#define PUT_REAL(e,r)                                          \
-do {                                                           \
-     if (HOST_FLOAT_WORDS_BIG_ENDIAN == REAL_WORDS_BIG_ENDIAN) \
-       etoe53 ((e), (unsigned EMUSHORT *) (r));                        \
-     else                                                      \
-       {                                                       \
-        unsigned EMUSHORT w[4];                                \
-        etoe53 ((e), w);                                       \
-        *((EMUSHORT *) r) = w[3];                              \
-        *((EMUSHORT *) r + 1) = w[2];                          \
-        *((EMUSHORT *) r + 2) = w[1];                          \
-        *((EMUSHORT *) r + 3) = w[0];                          \
-       }                                                       \
+#define PUT_REAL(e,r)                                                  \
+do {                                                                   \
+     if (HOST_FLOAT_WORDS_BIG_ENDIAN == REAL_WORDS_BIG_ENDIAN)         \
+       etoe53 ((e), (unsigned EMUSHORT *) (r));                                \
+     else                                                              \
+       {                                                               \
+        unsigned EMUSHORT w[4];                                        \
+        etoe53 ((e), w);                                               \
+         bcopy (&w[3], ((EMUSHORT *) r), sizeof (EMUSHORT));           \
+         bcopy (&w[2], ((EMUSHORT *) r) + 1, sizeof (EMUSHORT));       \
+         bcopy (&w[1], ((EMUSHORT *) r) + 2, sizeof (EMUSHORT));       \
+         bcopy (&w[0], ((EMUSHORT *) r) + 3, sizeof (EMUSHORT));       \
+       }                                                               \
    } while (0)
 
 #else /* not REAL_ARITHMETIC */