[Bug target/33381] [4.2 regression] miscompilation casting signed long to void*

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Sep 21 13:37:00 GMT 2007



------- Comment #5 from rguenth at gcc dot gnu dot org  2007-09-21 13:36 -------
This was fixed by the introduction of pointer-plus, which removed all traces
of fold_used_pointer* in tree-scalar-evolution.c.

A safe patch would go along the following:

Index: tree-vrp.c
===================================================================
--- tree-vrp.c  (revision 128649)
+++ tree-vrp.c  (working copy)
@@ -2482,6 +2482,13 @@ adjust_range_with_scev (value_range_t *v
   if (vr->type == VR_ANTI_RANGE)
     return;

+  /* Don't try to feed SCEV with casts to pointer type.  */
+  if (TREE_CODE (stmt) == MODIFY_EXPR
+      && (TREE_CODE (TREE_OPERAND (stmt, 1)) == NOP_EXPR
+         || TREE_CODE (TREE_OPERAND (stmt, 1)) == CONVERT_EXPR)
+      && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (stmt, 1))))
+    return;
+
   chrec = instantiate_parameters (loop, analyze_scalar_evolution (loop, var));
   if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
     return;


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-09-11 11:31:46         |2007-09-21 13:36:53
               date|                            |


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



More information about the Gcc-bugs mailing list