1 // { dg-require-effective-target alloca }
2 /* PR middle-end/86528 */
3 
4 void __attribute__((noinline, noclone))
test(char * data,__SIZE_TYPE__ len)5 test(char *data, __SIZE_TYPE__ len)
6 {
7     static char const appended[] = "/./";
8     char *buf = __builtin_alloca (len + sizeof appended);
9     __builtin_memcpy (buf, data, len);
10     __builtin_strcpy (buf + len, &appended[data[len - 1] == '/']);
11     if (__builtin_strcmp(buf, "test1234/./"))
12         __builtin_abort();
13 }
14 
15 int
main()16 main()
17 {
18    char *arg = "test1234/";
19    test(arg, __builtin_strlen(arg));
20    return 0;
21 }
22