From 7c819e8ae28435601df531215419957814990cd5 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 4 Jul 2017 12:53:18 +0200 Subject: [PATCH] Enable addressable params sanitization with --param asan-stack=1. 2017-07-04 Martin Liska PR sanitizer/81040 * sanopt.c (sanitize_rewrite_addressable_params): Mark the newly created variable as DECL_IGNORED_P. 2017-07-04 Martin Liska PR sanitizer/81040 * g++.dg/asan/function-argument-1.C: Run the test-case w/o use-after-scope sanitization. From-SVN: r249960 --- gcc/ChangeLog | 6 ++++++ gcc/sanopt.c | 2 +- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/asan/function-argument-1.C | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ee94e81496c..dda6ea47ea5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-04 Martin Liska + + PR sanitizer/81040 + * sanopt.c (sanitize_rewrite_addressable_params): Mark the + newly created variable as DECL_IGNORED_P. + 2017-07-04 Martin Liska PR ipa/81293 diff --git a/gcc/sanopt.c b/gcc/sanopt.c index 7692f6a9db7..b7740741d43 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -905,7 +905,7 @@ sanitize_rewrite_addressable_params (function *fun) tree var = build_decl (DECL_SOURCE_LOCATION (arg), VAR_DECL, DECL_NAME (arg), type); TREE_ADDRESSABLE (var) = 1; - DECL_ARTIFICIAL (var) = 1; + DECL_IGNORED_P (var) = 1; gimple_add_tmp_var (var); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eb2bdad9966..7a2e2ae3a6f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-07-04 Martin Liska + + PR sanitizer/81040 + * g++.dg/asan/function-argument-1.C: Run the test-case w/o + use-after-scope sanitization. + 2017-07-04 Jakub Jelinek * g++.dg/asan/function-argument-3.C: Add -Wno-psabi to additional diff --git a/gcc/testsuite/g++.dg/asan/function-argument-1.C b/gcc/testsuite/g++.dg/asan/function-argument-1.C index 148c4628316..bdbb37a44a4 100644 --- a/gcc/testsuite/g++.dg/asan/function-argument-1.C +++ b/gcc/testsuite/g++.dg/asan/function-argument-1.C @@ -1,5 +1,6 @@ // { dg-do run } // { dg-shouldfail "asan" } +// { dg-options "-fsanitize=address -fno-sanitize-address-use-after-scope" } struct A { -- 2.30.2