]> 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>
Wed, 2 Apr 2025 17:28:20 +0000 (19:28 +0200)
commit29bc904cb827615ed9f36bc3742ccc4ac77515ec
tree7fa87245cc2b21e87f6012a8b0e9850578de03f9
parentaca8155c09001f269a20d6df438fa0e749dd5388
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.
gcc/c/c-typeck.cc
gcc/testsuite/gcc.dg/asan/pr119582.c [new file with mode: 0644]