[tree-ssa] where to fix this? (tentative patch)

Dale Johannesen dalej@apple.com
Tue Dec 23 23:05:00 GMT 2003


On Dec 22, 2003, at 8:07 PM, Roger Sayle wrote:
> On Mon, 22 Dec 2003, Dale Johannesen wrote:
>>>>>> I have a case where tree-ssa is calling fold() on this:
>
> My apologies for not reading this thread earlier.  The problem, as
> I suspect may have already been pointed out, is that the operands of
> the PLUS_EXPR don't have types matching that of the PLUS_EXPR itself.

Well, thanks everybody, it would be nice to reach agreement on this 
stuff
before code gets written, don't you think?
Anyway, this patch seems to fix it.  Testing is not done yet but I'm 
putting it
out here for people to comment on.

Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.98
diff -u -d -b -w -r1.1.2.98 tree-ssa-dom.c
--- tree-ssa-dom.c      16 Dec 2003 21:42:31 -0000      1.1.2.98
+++ tree-ssa-dom.c      23 Dec 2003 21:04:59 -0000
@@ -1802,6 +1802,12 @@
                       && is_gimple_min_invariant (val)))
                 may_have_exposed_new_symbols = true;

+             /* Make sure types match.  We cannot substitute a
+                boolean for an int for example, fold() doesn't
+                handle this as we would like.  */
+             if (TREE_TYPE (*op_p) != TREE_TYPE (val))
+               val = convert (TREE_TYPE (*op_p), val);
+
               propagate_value (op_p, val);

               /* And note that we modified this statement.  This is now



More information about the Gcc mailing list