1 /* { dg-options "-fdump-tree-sanopt" } */
2 /* { dg-do compile } */
3 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
4
5 char
foo(int * a,char * b,char * c)6 foo (int *a, char *b, char *c)
7 {
8 /* One check for b[0], one check for a[]. */
9 __builtin_memmove (c, b, a[b[0]]);
10 /* One check for c[0], one check for a[]. */
11 __builtin_memmove (b, c, a[c[0]]);
12 /* No checks here. */
13 return c[0] + b[0];
14 /* For a total of 4 checks. */
15 }
16
17 /* { dg-final { scan-tree-dump-times "& 7" 4 "sanopt" } } */
18 /* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 2 "sanopt" } } */
19 /* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4" 2 "sanopt" } } */
20