summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr44404.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr44404.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr44404.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr44404.c b/gcc/testsuite/gcc.dg/pr44404.c
new file mode 100644
index 000000000..a0b4ceb98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44404.c
@@ -0,0 +1,35 @@
+/* PR rtl-optimization/44404
+ foo() used to be miscompiled on ARM due to a bug in auto-inc-dec.c,
+ which resulted in "strb r1, [r1], #-36". */
+
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-unroll-loops" } */
+
+extern char *strcpy (char *, const char *);
+extern int strcmp (const char*, const char*);
+extern void abort (void);
+
+char buf[128];
+
+void __attribute__((noinline))
+bar (int a, const char *p)
+{
+ if (strcmp (p, "0123456789abcdefghijklmnopqrstuvwxyz") != 0)
+ abort ();
+}
+
+void __attribute__((noinline))
+foo (int a)
+{
+ if (a)
+ bar (0, buf);
+ strcpy (buf, "0123456789abcdefghijklmnopqrstuvwxyz");
+ bar (0, buf);
+}
+
+int
+main (void)
+{
+ foo (0);
+ return 0;
+}