https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117209
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:0bf979d57d58a5fb2f118c902252ef49f03b34c1 commit r13-9562-g0bf979d57d58a5fb2f118c902252ef49f03b34c1 Author: Jakub Jelinek <[email protected]> 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 <[email protected]> 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)
