cleanup code to get around vpn issue in sign_mask
authorzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 25 Aug 2013 18:54:49 +0000 (18:54 +0000)
committerzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 25 Aug 2013 18:54:49 +0000 (18:54 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@201979 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/wide-int.cc
gcc/wide-int.h

index fc3847a..37ce5b3 100644 (file)
@@ -171,6 +171,12 @@ wide_int_ro::from_rtx (const rtx_mode_t r)
     case CONST_INT:
       result.val[0] = INTVAL (x);
       result.len = 1;
+
+#if 0
+      if (prec != HOST_BITS_PER_WIDE_INT)
+       gcc_assert (result.val[0] == sext_hwi (result.val[0], prec));
+#endif
+
 #ifdef DEBUG_WIDE_INT
       debug_wh ("wide_int:: %s = from_rtx ("HOST_WIDE_INT_PRINT_HEX")\n",
                result, INTVAL (x));
index ebb2a1a..ea4727a 100644 (file)
@@ -1843,7 +1843,6 @@ wide_int_ro::zforce_to_size (unsigned int prec) const
 inline HOST_WIDE_INT
 wide_int_ro::sign_mask () const
 {
-  int i = len - 1;
   if (precision < HOST_BITS_PER_WIDE_INT)
     {
       /* We don't allow a int:0 inside a struct to get this far,
@@ -1853,14 +1852,13 @@ wide_int_ro::sign_mask () const
              >> (HOST_BITS_PER_WIDE_INT - 1));
     }
 
-  /* VRP appears to be badly broken and this is a very ugly fix.  */
-  if (i >= 0)
-    return val[i] >> (HOST_BITS_PER_WIDE_INT - 1);
-
-  gcc_unreachable ();
-#if 0
-  return val[len - 1] >> (HOST_BITS_PER_WIDE_INT - 1);
-#endif
+  /* TREE_VRP is not able to see that it is not possible for len to be
+     0.  So without this test, it warns about this which causes
+     bootstrap failures.  */
+  if (len < 1)
+    gcc_unreachable ();
+  else
+    return val[len - 1] >> (HOST_BITS_PER_WIDE_INT - 1);
 }
 
 /* Return THIS & C.  */