------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-13 
23:18 -------
(In reply to comment #7)
> Subject: Re:  [4.0 regression] ICE: tree
>         check: expected ssa_name, have addr_expr in vrp_hash
> 
> So what does the condition look like?  I don't think we should be 
> getting into this code with anything other than an SSA_NAME as
> the first argument in a COND_EXPR.
Sorry about that, I was still working through the code of DOM.

The condition looks like &0B->a == 0 which means that the 0 is an integer but 
other size of the equal 
expression is a pointer.  This means that the types are mismatched by the 
front-end.
This patch is the correct fix which fixes the problem in the front-end which 
fixes the mismatched types:
Index: class.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.692
diff -u -p -r1.692 class.c
--- class.c     8 Dec 2004 08:35:33 -0000       1.692
+++ class.c     13 Dec 2004 23:12:29 -0000
@@ -295,8 +295,11 @@ build_base_path (enum tree_code code,
 
   /* Now that we've saved expr, build the real null test.  */
   if (null_test)
-    null_test = fold (build2 (NE_EXPR, boolean_type_node,
-                             expr, integer_zero_node));
+    {
+      tree zero = cp_convert (TREE_TYPE (expr), integer_zero_node);
+      null_test = fold (build2 (NE_EXPR, boolean_type_node,
+                               expr, zero));
+    }
 
   /* If this is a simple base reference, express it as a COMPONENT_REF.  */
   if (code == PLUS_EXPR && !virtual_access



I found where the problem was in the front-end by using this patch which 
catches mismatched types 
with EQ_EXPR and NE_EXPRs (only, it should be extended for 4.1 to support more 
expressions):
Index: tree.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.456
diff -u -p -r1.456 tree.c
--- tree.c      9 Dec 2004 10:54:36 -0000       1.456
+++ tree.c      13 Dec 2004 23:16:53 -0000
@@ -2573,6 +2573,10 @@ build2_stat (enum tree_code code, tree t
 
   t = make_node_stat (code PASS_MEM_STAT);
   TREE_TYPE (t) = tt;
+  if (code == EQ_EXPR || code == NE_EXPR)
+    {
+      gcc_assert (TREE_TYPE (arg0) == TREE_TYPE (arg1));
+    }
 
   /* Below, we automatically set TREE_SIDE_EFFECTS and TREE_READONLY for the
      result based on those same flags for the arguments.  But if the


-- 


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

Reply via email to