https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119399
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>: https://gcc.gnu.org/g:261bcbf171ffff021d20323ff0271f1e33850ff4 commit r13-9615-g261bcbf171ffff021d20323ff0271f1e33850ff4 Author: Richard Sandiford <richard.sandif...@arm.com> Date: Thu Apr 24 14:21:32 2025 +0100 Avoid using POINTER_DIFF_EXPR for overlap checks [PR119399] In r10-4803-g8489e1f45b50600c I'd used POINTER_DIFF_EXPR to subtract the two pointers involved in an overlap test. I'm not sure whether I'd specifically chosen that over MINUS_EXPR or not; if so, the only reason I can think of is that it is probably faster on targets with PSImode pointers. Regardless, as the PR points out, subtracting unrelated pointers using POINTER_DIFF_EXPR is undefined behaviour. gcc/ PR tree-optimization/119399 * tree-data-ref.cc (create_waw_or_war_checks): Use a MINUS_EXPR on two converted pointers, rather than converting a POINTER_DIFF_EXPR on the pointers. gcc/testsuite/ PR tree-optimization/119399 * gcc.dg/vect/pr119399.c: New test. (cherry picked from commit 4c8c373495d7d863dfb7102726ac3b4b41685df4)