]> git.ipfire.org Git - thirdparty/gcc.git/commit
Avoid using POINTER_DIFF_EXPR for overlap checks [PR119399]
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 25 Apr 2025 11:04:47 +0000 (12:04 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Fri, 25 Apr 2025 11:04:47 +0000 (12:04 +0100)
commitd419ea32d8968d8e88d0e7f5d8ecc57d610a5a3b
tree7bb06bb96c30b434512e12c2040ecbbcee12d293
parenta895b98c6722277c5129dd5d813bbb2e8ac9c98f
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)
gcc/testsuite/gcc.dg/vect/pr119399.c [new file with mode: 0644]
gcc/tree-data-ref.cc