2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / c-c++-common / asan / no-redundant-instrumentation-2.c
blob143312fb2f67b50041efae61014bd9329a79101b
1 /* This tests that when faced with two references to the same memory
2 location in the same basic block, the second reference should not
3 be instrumented by the Address Sanitizer. But in case of access to
4 overlapping regions we must be precise. */
6 /* { dg-options "-fdump-tree-asan0" } */
7 /* { dg-do compile } */
8 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
10 int
11 main ()
13 char tab[5];
15 /* Here, we instrument the access at offset 0 and access at offset
16 4. */
17 __builtin_memset (tab, 1, sizeof (tab));
18 /* We instrumented access at offset 0 above already, so only access
19 at offset 3 is instrumented. */
20 __builtin_memset (tab, 1, 3);
23 /* { dg-final { scan-tree-dump-times "& 7" 3 "asan0" } } */
24 /* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 2 "asan0" } } */
25 /* { dg-final { scan-tree-dump-times "__builtin___asan_report" 2 "asan0" } } */
26 /* { dg-final { cleanup-tree-dump "asan0" } } */