]> git.ipfire.org Git - thirdparty/gcc.git/commit
c: Fix ICEs with -fsanitize=pointer-{subtract,compare} [PR119582]
authorJakub Jelinek <jakub@redhat.com>
Wed, 2 Apr 2025 17:28:20 +0000 (19:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 13 Jun 2025 11:03:08 +0000 (13:03 +0200)
commit11ddb39cbd1b53a9079d04d48dff5a183b52ce85
tree68611eb5526831585ca634fd06689ca98faf000f
parentaffa145910b6768ec32b46666409a1c2f38e1a10
c: Fix ICEs with -fsanitize=pointer-{subtract,compare} [PR119582]

The following testcase ICEs because c_fully_fold isn't performed on the
arguments of __sanitizer_ptr_{sub,cmp} builtins and so e.g.
C_MAYBE_CONST_EXPR can leak into the gimplifier where it ICEs.

2025-04-02  Jakub Jelinek  <jakub@redhat.com>

PR c/119582
* c-typeck.cc (pointer_diff, build_binary_op): Call c_fully_fold on
__sanitizer_ptr_sub or __sanitizer_ptr_cmp arguments.

* gcc.dg/asan/pr119582.c: New test.

(cherry picked from commit 29bc904cb827615ed9f36bc3742ccc4ac77515ec)
gcc/c/c-typeck.cc
gcc/testsuite/gcc.dg/asan/pr119582.c [new file with mode: 0644]