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



--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-18 
10:19:20 UTC ---

(In reply to comment #6)

>     i_6 = (intptr_t) &MEM[(void *)&x + 4B];

>     j_7 = (intptr_t) &y;

>     _8 = i_6 == j_7;

> 

> forwprop will call fold with (intptr_t) &MEM[(void *)&x + 4B] == (intptr_t) &y

> But a pointer -> signed/unsigned is not a sign-changing comparison really.



Yeah, that is why I think fold_sign_changed_comparison should just punt on

pointer-changes altogether, not allow them for NE_EXPR/EQ_EXPR.



So

    if (TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type)

        && code != NE_EXPR

        && code != EQ_EXPR)

      return NULL_TREE;



    if (POINTER_TYPE_P (inner_type) != POINTER_TYPE_P (outer_type))

      return NULL_TREE;

Reply via email to