diff gcc/testsuite/gcc.c-torture/execute/pr86528.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children 1830386684a0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gcc.c-torture/execute/pr86528.c	Thu Oct 25 07:37:49 2018 +0900
@@ -0,0 +1,20 @@
+/* PR middle-end/86528 */
+
+void __attribute__((noinline, noclone))
+test(char *data, __SIZE_TYPE__ len)
+{
+    static char const appended[] = "/./";
+    char *buf = __builtin_alloca (len + sizeof appended);
+    __builtin_memcpy (buf, data, len);
+    __builtin_strcpy (buf + len, &appended[data[len - 1] == '/']);
+    if (__builtin_strcmp(buf, "test1234/./"))
+        __builtin_abort();
+}
+
+int
+main()
+{
+   char *arg = "test1234/";
+   test(arg, __builtin_strlen(arg));
+   return 0;
+}