I fell over an ICE where wide_int_to_type_1's expectations of pointer
value caching didn't match that of cache_integer_cst's behaviour.  I
don't know why it only exhibited on the modules branch, but it seems
pretty wrong.  This patch matches up the behaviours and adds a comment
about that.

        gcc/
        * tree.c (cache_integer_cst): Fixup pointer caching to match
        wide_int_to_type_1's expectations.  Add comment.

pushing to trunk

nathan
--
Nathan Sidwell
diff --git i/gcc/tree.c w/gcc/tree.c
index 81f867ddded..a576b986f8b 100644
--- i/gcc/tree.c
+++ w/gcc/tree.c
@@ -1737,6 +1737,8 @@ cache_integer_cst (tree t)
 
   gcc_assert (!TREE_OVERFLOW (t));
 
+  /* The caching indices here must match those in
+     wide_int_to_type_1.  */
   switch (TREE_CODE (type))
     {
     case NULLPTR_TYPE:
@@ -1745,12 +1747,15 @@ cache_integer_cst (tree t)
 
     case POINTER_TYPE:
     case REFERENCE_TYPE:
-      /* Cache NULL pointer.  */
-      if (integer_zerop (t))
-	{
-	  limit = 1;
+      {
+	if (integer_zerop (t))
 	  ix = 0;
-	}
+	else if (integer_onep (t))
+	  ix = 2;
+
+	if (ix >= 0)
+	  limit = 3;
+      }
       break;
 
     case BOOLEAN_TYPE:

Reply via email to