2 /* { dg-options "-O2" } */
6 __attribute__((noinline, noclone)) char *
7 fn1 (char *p, size_t *l)
9 char *q = strcat (p, "abcde");
14 __attribute__((noinline, noclone)) char *
15 fn2 (char *p, const char *q, size_t *l1, size_t *l2)
17 size_t l = strlen (q);
18 char *r = strcat (p, q);
24 __attribute__((noinline, noclone)) char *
25 fn3 (char *p, const char *q, size_t *l)
27 char *r = strcpy (p, q);
32 __attribute__((noinline, noclone)) char *
33 fn4 (char *p, const char *q, size_t *l)
35 char *r = strcat (p, q);
40 __attribute__((noinline, noclone)) char *
41 fn5 (char *p, const char *q, size_t *l1, size_t *l2, size_t *l3)
43 size_t l = strlen (q);
44 size_t ll = strlen (p);
45 char *r = strcat (p, q);
52 __attribute__((noinline, noclone)) char *
53 fn6 (char *p, const char *q, size_t *l1, size_t *l2)
55 size_t l = strlen (p);
56 char *r = strcat (p, q);
66 const char *volatile q = "fgh";
68 memset (buf, '\0', sizeof buf);
70 if (fn1 (buf, &l) != buf || l != 8 || memcmp (buf, "aaaabcde", 9) != 0)
72 if (fn2 (buf, q, &l1, &l2) != buf || l1 != 3 || l2 != 11
73 || memcmp (buf, "aaaabcdefgh", 12) != 0)
75 if (fn3 (buf, q, &l) != buf || l != 3
76 || memcmp (buf, "fgh\0bcdefgh", 12) != 0)
78 if (fn4 (buf, q, &l) != buf || l != 6
79 || memcmp (buf, "fghfgh\0efgh", 12) != 0)
83 if (fn5 (buf, q, &l1, &l2, &l3) != buf || l1 != 3 || l2 != 9 || l3 != 6
84 || memcmp (buf, "fghfghfgh\0h", 12) != 0)
86 if (fn6 (buf, q, &l1, &l2) != buf || l1 != 12 || l2 != 9
87 || memcmp (buf, "fghfghfghfgh", 13) != 0)