Skip to content
Snippets Groups Projects
Commit 885143fa authored by Jakub Jelinek's avatar Jakub Jelinek Committed by Jakub Jelinek
Browse files

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  <jakub@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.
parent f6fbc0d2
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment