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