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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-12-08

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
We do this for &x + C {!=,==} &x' + C' - I think we're afraid of relational
compares here though, even with TYPE_OVERFLOW_UNDEFINED.

/* (&a+b) !=/== (&a[1] + c) ->  sizeof(a[0]) + b !=/== c */
(for neeq (ne eq)
 (simplify 
  (neeq (pointer_plus ADDR_EXPR@0 @1) (pointer_plus ADDR_EXPR@2 @3))
   (with { poly_int64 diff; tree inner_type = TREE_TYPE (@1);}
    (if (ptr_difference_const (@0, @2, &diff))
     (neeq (plus { build_int_cst_type (inner_type, diff); } @1) @3)))))

that could be relaxed to general @0/@2 (at some cost) and to
relational compares with TYPE_OVERFLOW_UNDEFINED.

Reply via email to