This is the mail archive of the 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] PATCH: disallow const-prop when types don't match

In message <>, Dale Johannesen wr
 >This revises my previous patch
 >based on Jeff Law's comments.  Bootstrapped and tested on Darwin.
 >2004-01-19  Dale Johannesen  <>
 >         * tree-ssa-dom.c (cprop_into_stmt):  Add convert() call
 >         to prevent type mismatches.
 >Index: tree-ssa-dom.c
 >RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
 >retrieving revision
 >diff -u -d -b -w -c -3 -p -r1.1.2.114 tree-ssa-dom.c
 >cvs server: conflicting specifications of output style
 >*** tree-ssa-dom.c      16 Jan 2004 06:09:23 -0000
 >--- tree-ssa-dom.c      20 Jan 2004 00:48:38 -0000
 >*************** cprop_into_stmt (tree stmt)
 >*** 1948,1953 ****
 >--- 1948,1966 ----
 >                       || TREE_CODE (val) != SSA_NAME))
 >                 continue;
 >+               /* Make sure basic types match.  We cannot substitute a
 >+                  boolean for an int for example, fold() doesn't
 >+                  handle this as we would like.  But don't create
 >+                  non-gimple trees; if we would, just skip it. */
 >+               if (TREE_TYPE (*op_p) != TREE_TYPE (val)
 >+                 && TREE_CODE (val) != SSA_NAME)
 >+                 {
 >+                   val = convert (TREE_TYPE (*op_p), val);
 >+                   if (!is_gimple_min_invariant (val) &&
 >+                     TREE_CODE (val) != SSA_NAME)
 >+                     continue;
 >+                 }
I made a couple minor formatting changes.  For example, "&&" should never
go and the end of a line, instead it should always go at the start of
the next line.  ie

  if (!is_gimple_min_invariant (val)
      && TREE_CODE (val) != SSA_NAME)

Instead of

  if (!is_gimple_min_invariant (val) &&
      TREE_CODE (val) != SSA_NAME)

When referring to function names in comments or ChangeLog entries we do not
generally add parenthesis -- just use the function name as-is.

I also fixed a missing double-quote in the test.

Bootstrapped and regression tested on i686-pc-linux-gnu.  Installed.


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