On Wed, Jan 31, 2024 at 09:51:05AM +0100, 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.
Indeed. But what we could do is try to fold_stmt those .ASAN_MARK calls away earlier (but sure, the asan.cc change would be still required because that would be just an optimization). But that can be handled incrementally, so I think the patch is ok as is (and I can handle the incremental part myself). Note, the handling of global vars in asan is done only at the end (asan_finish_file), so I think such late TREE_STATIC marked vars will still be correctly treated as global vars if varpool knows about them (and if varpool doesn't, then lots of other things would break). Jakub