diff options
-rw-r--r-- | gcc/asan.h | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/pr101331.C | 7 |
2 files changed, 10 insertions, 2 deletions
@@ -255,8 +255,9 @@ static inline bool sanitize_coverage_p (const_tree fn = current_function_decl) { return (flag_sanitize_coverage - && lookup_attribute ("no_sanitize_coverage", - DECL_ATTRIBUTES (fn)) == NULL_TREE); + && (fn == NULL_TREE + || lookup_attribute ("no_sanitize_coverage", + DECL_ATTRIBUTES (fn)) == NULL_TREE)); } #endif /* TREE_ASAN */ diff --git a/gcc/testsuite/g++.dg/pr101331.C b/gcc/testsuite/g++.dg/pr101331.C new file mode 100644 index 0000000..015aba2 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr101331.C @@ -0,0 +1,7 @@ +// PR c++/101331 +// { dg-do compile } +// { dg-options "-fsanitize-coverage=trace-pc -O2 -std=c++11" } + +int a[2]; +int b = 1; +int c { b && (a[b] = 0) }; |