2 /* { dg-options "-O2 -fdump-tree-strlen" } */
6 __attribute__((noinline
, noclone
)) char *
7 foo (char *p
, const char *q
)
9 char *e
= strchr (p
, '\0');
14 __attribute__((noinline
, noclone
)) char *
17 memcpy (p
, "abcd", 5);
18 return strchr (p
, '\0');
21 __attribute__((noinline
, noclone
)) void
24 char *e
= strchr (p
, '\0');
33 char *volatile p
= buf
;
34 const char *volatile q
= "ij";
36 if (foo (p
, q
) != buf
+ 3
37 || memcmp (buf
, "vvvij\0\0\0\0", 10) != 0)
39 memset (buf
, '\0', sizeof buf
);
40 if (bar (p
) != buf
+ 4
41 || memcmp (buf
, "abcd\0\0\0\0\0", 10) != 0)
44 memset (buf
+ 2, '\0', -2 + sizeof buf
);
46 if (memcmp (buf
, "vvabcd\0\0\0", 10) != 0)
51 /* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen" } } */
52 /* { dg-final { scan-tree-dump-times "memcpy \\(" 2 "strlen" } } */
53 /* { dg-final { scan-tree-dump-times "strcpy \\(" 1 "strlen" } } */
54 /* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */
55 /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */
56 /* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } */