https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81281
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Fri Dec 15 14:36:26 2017 New Revision: 255696 URL: https://gcc.gnu.org/viewcvs?rev=255696&root=gcc&view=rev Log: PR sanitizer/81281 * match.pd ((T)(P + A) - (T)P -> (T) A): Use @@0 instead of @0 and convert? on @0 instead of convert. Check type of @1, not @0. ((T)P - (T)(P + A) -> -(T) A): Use @@0 instead of @0 and convert? on @0 instead of convert. Check type of @1, not @0. ((T)(P + A) - (T)(P + B) -> (T)A - (T)B): Use @@0 instead of @0, only optimize if either both @1 and @2 types are narrower precision, or both are wider or equal precision, and in the former case only if both have undefined overflow. * gcc.dg/pr81281-3.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr81281-3.c Modified: trunk/gcc/ChangeLog trunk/gcc/match.pd trunk/gcc/testsuite/ChangeLog