From: Marat Zakirov Date: Wed, 11 Mar 2015 07:39:20 +0000 (+0000) Subject: asan.c (instrument_derefs): Disable instrumentation on asan-globals=0. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b98fab5f1ae21b76813630539e500e04c8a6952;p=gcc.git asan.c (instrument_derefs): Disable instrumentation on asan-globals=0. 2015-03-11 Marat Zakirov * asan.c (instrument_derefs): Disable instrumentation on asan-globals=0. * c-c++-common/asan/no-asan-check-glob.c: New test. From-SVN: r221345 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b77fb5e99d0..4a7f7881472 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-03-11 Marat Zakirov + + * asan.c (instrument_derefs): Disable instrumentation on asan-globals=0. + 2015-03-10 Jakub Jelinek PR target/65368 diff --git a/gcc/asan.c b/gcc/asan.c index b7c2b11ed54..9e4a6299817 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1820,6 +1820,8 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t, { if (DECL_THREAD_LOCAL_P (inner)) return; + if (!ASAN_GLOBALS && is_global_var (inner)) + return; if (!TREE_STATIC (inner)) { /* Automatic vars in the current function will be always diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a45346aaf18..7253a53b239 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-03-11 Marat Zakirov + + * c-c++-common/asan/no-asan-check-glob.c: New test. + 2015-03-10 Paolo Carlini PR c++/65370 diff --git a/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c b/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c new file mode 100644 index 00000000000..a1b1410f7d6 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c @@ -0,0 +1,13 @@ +/* { dg-options "--param asan-globals=0 -fdump-tree-asan" } */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "*" } } */ + +extern int a; + +int foo () +{ + return a; +} + +/* { dg-final { scan-tree-dump-times "ASAN_CHECK" 0 "asan1" } } */ +/* { dg-final { cleanup-tree-dump "asan1" } } */