[Bug middle-end/30704] [4.2/4.3 Regression] Incorrect constant generation for long long

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Mar 12 22:25:00 GMT 2007



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-03-12 22:25 -------
Index: ../../gcc/fold-const.c
===================================================================
--- ../../gcc/fold-const.c      (revision 122864)
+++ ../../gcc/fold-const.c      (working copy)
@@ -7357,6 +7357,7 @@ native_interpret_real (tree type, unsign
      up to 192 bits.  */
   REAL_VALUE_TYPE r;
   long tmp[6];
+  long tmp1[6];

   total_bytes = GET_MODE_SIZE (TYPE_MODE (type));
   if (total_bytes > len || total_bytes > 24)
@@ -7386,6 +7387,11 @@ native_interpret_real (tree type, unsign
     }

   real_from_target (&r, tmp, mode);
+  real_to_target (tmp1, &r, mode);
+  /* If the encoded real is going to decode differently, then reject the
constant
+     conversion. */
+  if (memcpy (tmp, tmp1,  total_bytes) != 0)
+    return NULL;
   return build_real (type, r);
 }


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30704



More information about the Gcc-bugs mailing list