skip asan-poisoning of discarded vars

Alexandre Oliva oliva@adacore.com
Fri Jan 22 01:07:31 GMT 2021


On Jan 21, 2021, Alexandre Oliva <oliva@adacore.com> wrote:

> On Jan 21, 2021, Alexandre Oliva <oliva@adacore.com> wrote:
>> But I was wrong.  The bootstrap with the added assert has just failed,
>> as early as stage2 libiberty.  Looking into it...

> Uhh, I take that back.  I just goofed in the assert, inverting the
> condition.  Long day...

> With the correct condition, it's got past the stage2 compilation of all
> of the gcc deps and Ada sources, and then some.  Maybe my reasoning
> wasn't wrong, after all ;-)

Yeah, confirmed, bootstrap-asan (and -ubsan) completed on
x86_64-linux-gnu, all languages, with the following patchlet
(cut&pasted, then retabified manually, so it may not apply
mechanically):

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index d2ac5f9..c0dcb39 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1797,6 +1797,9 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
 	  && dbg_cnt (asan_use_after_scope)
 	  && !gimplify_omp_ctxp)
 	{
+	  gcc_assert (DECL_SEEN_IN_BIND_EXPR_P (decl)
+		      || (DECL_ARTIFICIAL (decl) 
+			  && DECL_NAME (decl) == NULL_TREE));
 	  asan_poisoned_variables->add (decl);
 	  asan_poison_variable (decl, false, seq_p);
 	  if (!DECL_ARTIFICIAL (decl) && gimplify_ctxp->live_switch_vars)


-- 
Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
   Free Software Activist         GNU Toolchain Engineer
        Vim, Vi, Voltei pro Emacs -- GNUlius Caesar


More information about the Gcc-patches mailing list