On 1/31/24 03:51, Richard Biener wrote:
On Wed, Jan 31, 2024 at 4:38 AM Jason Merrill <ja...@redhat.com> wrote:
Tested x86_64-pc-linux-gnu, OK for trunk?
It's a quite "late" fixup, I suppose you have tried to avoid marking it
during gimplification? I see we do parts of this during BIND_EXPR
processing which is indeed a bit early but possibly difficult to rectify.
I also considered
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 7f79b3cc7e6..c906d927a09 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -1249,6 +1249,10 @@ asan_poison_variable (tree decl, bool poison,
gimple_stmt_iterator *it,
if (zerop (unit_size))
return;
+ /* Or variables in static storage. */
+ if (TREE_STATIC (decl))
+ return;
+
/* It's necessary to have all stack variables aligned to ASAN granularity
bytes. */
gcc_assert (!hwasan_sanitize_p () || hwasan_sanitize_stack_p ());
which fixes the bug by avoiding the poison mark, but it's too late to
avoid the unpoison mark--though the unpoison is still removed by sanopt,
so the end result is the same. I decided to send the other patch
because it applies to both, but I'm happy with either approach.
Jason