summaryrefslogtreecommitdiff
path: root/gcc/asan.h
diff options
context:
space:
mode:
authorMartin Liska <marxin@gcc.gnu.org>2017-01-23 12:06:13 +0000
committerMartin Liska <marxin@gcc.gnu.org>2017-01-23 12:06:13 +0000
commitf6b9f2ffc190054ca8f4dad110d85613964d2006 (patch)
tree36be2ac0b98ff565f4e87f29d7da27515ced8305 /gcc/asan.h
parenta51368fad9985f84e3215cf9897f389698fbbba5 (diff)
downloadgcc-f6b9f2ffc190054ca8f4dad110d85613964d2006.tar.gz
use-after-scope: handle writes to a poisoned variable
2017-01-23 Martin Liska <mliska@suse.cz> * gcc.dg/asan/use-after-scope-10.c: New test. * gcc.dg/asan/use-after-scope-11.c: New test. * g++.dg/asan/use-after-scope-5.C: New test. 2017-01-23 Jakub Jelinek <jakub@redhat.com> Martin Liska <mliska@suse.cz> * asan.h: Define ASAN_USE_AFTER_SCOPE_ATTRIBUTE. * asan.c (asan_expand_poison_ifn): Support stores and use appropriate ASAN report function. * internal-fn.c (expand_ASAN_POISON_USE): New function. * internal-fn.def (ASAN_POISON_USE): Declare. * tree-into-ssa.c (maybe_add_asan_poison_write): New function. (maybe_register_def): Create ASAN_POISON_USE when sanitizing. * tree-ssa-dce.c (eliminate_unnecessary_stmts): Remove ASAN_POISON calls w/o LHS. * tree-ssa.c (execute_update_addresses_taken): Create clobber for ASAN_MARK (UNPOISON, &x, ...) in order to prevent usage of a LHS from ASAN_MARK (POISON, &x, ...) coming to a PHI node. * gimplify.c (asan_poison_variables): Add attribute use_after_scope_memory to variables that really needs to live in memory. * tree-ssa.c (is_asan_mark_p): Do not rewrite into SSA when having the attribute. From-SVN: r244793
Diffstat (limited to 'gcc/asan.h')
-rw-r--r--gcc/asan.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/asan.h b/gcc/asan.h
index 2895bdee645..57663977603 100644
--- a/gcc/asan.h
+++ b/gcc/asan.h
@@ -67,6 +67,8 @@ extern hash_set <tree> *asan_used_labels;
#define ASAN_STACK_FRAME_MAGIC 0x41b58ab3
#define ASAN_STACK_RETIRED_MAGIC 0x45e0360e
+#define ASAN_USE_AFTER_SCOPE_ATTRIBUTE "use after scope memory"
+
/* Various flags for Asan builtins. */
enum asan_check_flags
{