Debian Codegraph @

gcc/testsuite/gcc.dg/asan/sancov-1.c

raw
1 /* Test coverage/asan interaction:
2 - coverage instruments __asan_init ctor (thus 4 covarage callbacks)
3 - coverage does not instrument asan-emitted basic blocks
4 - asan considers coverage callback as "nonfreeing" (thus 1 asan store
5 callback. */
6 /* { dg-do compile } */
7 /* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
8 /* { dg-options "-fsanitize-coverage=trace-pc -fsanitize=address -fdump-tree-optimized" } */
9
10 void foo(volatile int *a, int *b)
11 {
12 *a = 1;
13 if (*b)
14 *a = 2;
15 }
16
17 /* { dg-final { scan-tree-dump-times "__builtin___sanitizer_cov_trace_pc \\(\\)" 4 "optimized" } } */
18 /* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4 \\(" 1 "optimized" } } */
19 /* { dg-final { scan-tree-dump-times "__builtin___asan_report_store4 \\(" 1 "optimized" } } */