https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121764
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note there is no testcase testing the extended constant_pointer_difference usage directly. `gcc.dg/torture/pr45636.c` does show the difference if you look into the forwprop dump. If I get some time I will add a testcase that shows the missing optimization in that case. This is also mentioned in https://gcc.gnu.org/pipermail/gcc-patches/2010-October/296366.html .