https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117209
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:85221c95e3458de903ca9eeef76345e8326d3ec2 commit r14-10838-g85221c95e3458de903ca9eeef76345e8326d3ec2 Author: Jakub Jelinek <ja...@redhat.com> Date: Thu Oct 24 12:45:34 2024 +0200 asan: Fix up build_check_stmt gsi handling [PR117209] gsi_safe_insert_before properly updates gsi_bb in gimple_stmt_iterator in case it splits objects, but unfortunately build_check_stmt was in some places (but not others) using a copy of the iterator rather than the iterator passed from callers and so didn't propagate that to callers. I guess it didn't matter much before when it was just using gsi_insert_before as that really didn't change the iterator. The !before_p case is apparently dead code, nothing is calling it with before_p=false since around 4.9. 2024-10-24 Jakub Jelinek <ja...@redhat.com> PR sanitizer/117209 * asan.cc (maybe_cast_to_ptrmode): Formatting fix. (build_check_stmt): Don't copy *iter into gsi, perform all the updates on iter directly. * gcc.dg/asan/pr117209.c: New test. (cherry picked from commit 885143fa77599c44bfdd4e8e6b6987b7824db6ba)