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

--- Comment #5 from Mikael Pettersson <mikpe at it dot uu.se> 2011-03-10 
09:22:04 UTC ---
If I revert this part of r139061 then things work again:

    * gimplify.c (gimplify_conversion): Use maybe_fold_offset_to_address.

--- gcc/gimplify.c      (revision 139060)
+++ gcc/gimplify.c      (revision 139061)
@@ -1842,17 +1842,13 @@ gimplify_conversion (tree *expr_p)
   /* Attempt to avoid NOP_EXPR by producing reference to a subtype.
      For example this fold (subclass *)&A into &A->subclass avoiding
      a need for statement.  */
-  if (TREE_CODE (*expr_p) == NOP_EXPR
+  if (CONVERT_EXPR_P (*expr_p)
       && POINTER_TYPE_P (TREE_TYPE (*expr_p))
       && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (*expr_p, 0)))
-      && (tem = maybe_fold_offset_to_reference
+      && (tem = maybe_fold_offset_to_address
                  (TREE_OPERAND (*expr_p, 0),
-                  integer_zero_node, TREE_TYPE (TREE_TYPE (*expr_p)))))
-    {
-      tree ptr_type = build_pointer_type (TREE_TYPE (tem));
-      if (useless_type_conversion_p (TREE_TYPE (*expr_p), ptr_type))
-        *expr_p = build_fold_addr_expr_with_type (tem, ptr_type);
-    }
+                  integer_zero_node, TREE_TYPE (*expr_p))) != NULL_TREE)
+    *expr_p = tem;

   /* If we still have a conversion at the toplevel,
      then canonicalize some constructs.  */

The first condition change is Ok, it's the change to call m_f_o_t_address
instead of m_f_o_t_reference and the then-clause change that matter.

Reverting this from trunk @ r139061 + r151559 backport, or trunk @ r151559,
eliminates the ICE.

Reply via email to