------- Comment #2 from rguenth at gcc dot gnu dot org  2008-05-13 12:54 -------
Part of the fix is

Index: fold-const.c
===================================================================
--- fold-const.c        (revision 135255)
+++ fold-const.c        (working copy)
@@ -6831,7 +6831,8 @@ fold_sign_changed_comparison (enum tree_
           && TREE_TYPE (TREE_OPERAND (arg1, 0)) == inner_type))
     return NULL_TREE;

-  if (TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type)
+  if ((TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type)
+       || POINTER_TYPE_P (inner_type) != POINTER_TYPE_P (outer_type))
       && code != NE_EXPR
       && code != EQ_EXPR)
     return NULL_TREE;


but the question is if the folding to POINTER_PLUS is correct at all.


-- 

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|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-05-13 12:54:21
               date|                            |


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

Reply via email to