Sync with upstream 4.9 branch
[official-gcc.git] / embedded-4_9-branch / gcc / testsuite / c-c++-common / asan / no-redundant-instrumentation-7.c
blob5baa10dcd7dbab0efe3589ae34732b15f4bd7cba
1 /* { dg-options "-fdump-tree-sanopt" } */
2 /* { dg-do compile } */
3 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
5 char e[200];
7 struct S
9 char a[100];
10 char b[100];
11 } s;
13 int
14 foo (int *a, char *b, char *c)
16 /* 2 checks for s.a, 2 checks for e. */
17 int d = __builtin_memcmp (s.a, e, 100);
18 /* One check for s.a and one check for e. */
19 d += __builtin_memcmp (s.a, e, 200);
20 /* For a total of 6 checks. */
21 return d;
24 /* { dg-final { scan-tree-dump-times "& 7" 6 "sanopt" } } */
25 /* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 4 "sanopt" } } */
26 /* { dg-final { scan-tree-dump-not "__builtin___asan_report_store" "sanopt" } } */
27 /* { dg-final { cleanup-tree-dump "sanopt" } } */