diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-03-28 16:45:21 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-03-28 14:45:21 +0000 |
commit | d838c2d5a8b1844c7c78596b9689339ec60731f3 (patch) | |
tree | 3bc231046d07cdde8d0c364d280ceeb49fe3a24d /gcc/gimplify.c | |
parent | a48b4234ddba56e6ac698a8a84f24176085dc099 (diff) | |
download | gcc-d838c2d5a8b1844c7c78596b9689339ec60731f3.zip gcc-d838c2d5a8b1844c7c78596b9689339ec60731f3.tar.gz gcc-d838c2d5a8b1844c7c78596b9689339ec60731f3.tar.bz2 |
Fix wrong use-after-scope sanitization for omp variable (PR sanitizer/85081).
2018-03-28 Jakub Jelinek <jakub@redhat.com>
Martin Liska <mliska@suse.cz>
PR sanitizer/85081
* gimplify.c (asan_poison_variable): Don't do the check for
gimplify_omp_ctxp here.
(gimplify_decl_expr): Do it here.
(gimplify_target_expr): Likewise.
2018-03-28 Jakub Jelinek <jakub@redhat.com>
Martin Liska <mliska@suse.cz>
PR sanitizer/85081
* g++.dg/asan/pr85081.C: New test.
Co-Authored-By: Martin Liska <mliska@suse.cz>
From-SVN: r258924
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 115f80b..c32869b4 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1168,10 +1168,6 @@ static void asan_poison_variable (tree decl, bool poison, gimple_stmt_iterator *it, bool before) { - /* When within an OMP context, do not emit ASAN_MARK internal fns. */ - if (gimplify_omp_ctxp) - return; - tree unit_size = DECL_SIZE_UNIT (decl); tree base = build_fold_addr_expr (decl); @@ -1689,7 +1685,8 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p) && !TREE_STATIC (decl) && !DECL_HAS_VALUE_EXPR_P (decl) && DECL_ALIGN (decl) <= MAX_SUPPORTED_STACK_ALIGNMENT - && dbg_cnt (asan_use_after_scope)) + && dbg_cnt (asan_use_after_scope) + && !gimplify_omp_ctxp) { asan_poisoned_variables->add (decl); asan_poison_variable (decl, false, seq_p); @@ -6614,7 +6611,8 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) } if (asan_poisoned_variables && DECL_ALIGN (temp) <= MAX_SUPPORTED_STACK_ALIGNMENT - && dbg_cnt (asan_use_after_scope)) + && dbg_cnt (asan_use_after_scope) + && !gimplify_omp_ctxp) { tree asan_cleanup = build_asan_poison_call_expr (temp); if (asan_cleanup) |