https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82976

--- Comment #13 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #12)
> match.pd looks like it has a type bug:
> /* Simplify pointer equality compares using PTA.  */
> (for neeq (ne eq)
>  (simplify
>   (neeq @0 @1)
>   (if (POINTER_TYPE_P (TREE_TYPE (@0))
>        && ptrs_compare_unequal (@0, @1))
>    { neeq == EQ_EXPR ? boolean_false_node : boolean_true_node; })))
> 
> 
> It assumes all types of EQ_EXPR/NE_EXPR will be boolean_type_node which is
> not true.
> It should be using constant_boolean_node (neeq != EQ_EXPR, type); .

I'll run a regression-test on

Index: match.pd
===================================================================
--- match.pd    (Revision 259152)
+++ match.pd    (Arbeitskopie)
@@ -3700,7 +3700,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
   (neeq @0 @1)
   (if (POINTER_TYPE_P (TREE_TYPE (@0))
        && ptrs_compare_unequal (@0, @1))
-   { neeq == EQ_EXPR ? boolean_false_node : boolean_true_node; })))
+   { constant_boolean_node (neeq != EQ_EXPR, type); })))

 /* PR70920: Transform (intptr_t)x eq/ne CST to x eq/ne (typeof x) CST.
    and (typeof ptr_cst) x eq/ne ptr_cst to x eq/ne (typeof x) CST.

and submit if it passes.

Reply via email to