This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]