aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-10-19 09:50:48 +0200
committerMartin Liska <marxin@gcc.gnu.org>2017-10-19 07:50:48 +0000
commit36208e6037b452fb2e7bdb7faf514dd98e531e26 (patch)
tree87ee9450aa3646da62f0fd75175d108e225a9a2b /gcc/gimplify.c
parentcd30a0b8fec5e27d43349e4d48e166f1ccde6306 (diff)
downloadgcc-36208e6037b452fb2e7bdb7faf514dd98e531e26.zip
gcc-36208e6037b452fb2e7bdb7faf514dd98e531e26.tar.gz
gcc-36208e6037b452fb2e7bdb7faf514dd98e531e26.tar.bz2
Do not instrument use-after-scope for vars with large alignment (PR sanitizer/82517).
2017-10-19 Martin Liska <mliska@suse.cz> PR sanitizer/82517 * gimplify.c (gimplify_decl_expr): Do not instrument variables that have a large alignment. (gimplify_target_expr): Likewise. 2017-10-19 Martin Liska <mliska@suse.cz> PR sanitizer/82517 * gcc.dg/asan/pr82517.c: New test. From-SVN: r253879
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index c3fd6ac..19411c9 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1656,6 +1656,7 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
&& TREE_ADDRESSABLE (decl)
&& !TREE_STATIC (decl)
&& !DECL_HAS_VALUE_EXPR_P (decl)
+ && DECL_ALIGN (decl) <= MAX_SUPPORTED_STACK_ALIGNMENT
&& dbg_cnt (asan_use_after_scope))
{
asan_poisoned_variables->add (decl);
@@ -6505,7 +6506,9 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
clobber = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, clobber);
gimple_push_cleanup (temp, clobber, false, pre_p, true);
}
- if (asan_poisoned_variables && dbg_cnt (asan_use_after_scope))
+ if (asan_poisoned_variables
+ && DECL_ALIGN (temp) <= MAX_SUPPORTED_STACK_ALIGNMENT
+ && dbg_cnt (asan_use_after_scope))
{
tree asan_cleanup = build_asan_poison_call_expr (temp);
if (asan_cleanup)