https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70920
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-05-03 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. Not sure about the non-zero constants though. At least non-equality pointer compares are only valid for pointers to the same object. This can be easily fixed with a new match.pd rule like (for cmp (ne eq) (simplify (cmp (convert @0) INTEGER_CST@1) (if (POINTER_TYPE_P (TREE_TYPE (@0))) (cmp @0 (convert @1))))) I wonder about the reverse transform when a is an integer and the cast is to a pointer type. I suppose we should strip the cast there as well.