aboutsummaryrefslogtreecommitdiff
path: root/gcc/asan.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-03-06 11:20:33 +0100
committerMartin Liska <marxin@gcc.gnu.org>2017-03-06 10:20:33 +0000
commita50a32aa3cbd139b2fbc56bcd80a82dc7f6ca5e5 (patch)
treecf302d2f084f1a67fbed6c9139a0cc3263e32f40 /gcc/asan.c
parent5ada812cedf5c5e4f602c6fc21bfc3744aa2ddcd (diff)
downloadgcc-a50a32aa3cbd139b2fbc56bcd80a82dc7f6ca5e5.zip
gcc-a50a32aa3cbd139b2fbc56bcd80a82dc7f6ca5e5.tar.gz
gcc-a50a32aa3cbd139b2fbc56bcd80a82dc7f6ca5e5.tar.bz2
Fix ICE in use-after-scope w/ -fno-tree-dce (PR sanitize/79783).
2017-03-06 Martin Liska <mliska@suse.cz> PR sanitize/79783 * asan.c (asan_expand_poison_ifn): Do not expand ASAN_POISON when having a SSA NAME w/o VAR_DECL assigned to it. 2017-03-06 Martin Liska <mliska@suse.cz> PR sanitize/79783 * g++.dg/asan/pr79783.C: New test. From-SVN: r245912
Diffstat (limited to 'gcc/asan.c')
-rw-r--r--gcc/asan.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/asan.c b/gcc/asan.c
index 6cdd59b..7223e3c 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -3107,12 +3107,16 @@ asan_expand_poison_ifn (gimple_stmt_iterator *iter,
{
gimple *g = gsi_stmt (*iter);
tree poisoned_var = gimple_call_lhs (g);
- if (!poisoned_var)
+ if (!poisoned_var || has_zero_uses (poisoned_var))
{
gsi_remove (iter, true);
return true;
}
+ if (SSA_NAME_VAR (poisoned_var) == NULL_TREE)
+ SET_SSA_NAME_VAR_OR_IDENTIFIER (poisoned_var,
+ create_tmp_var (TREE_TYPE (poisoned_var)));
+
tree shadow_var = create_asan_shadow_var (SSA_NAME_VAR (poisoned_var),
shadow_vars_mapping);