summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/pr42505.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/arm/pr42505.c')
-rw-r--r--gcc/testsuite/gcc.target/arm/pr42505.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/arm/pr42505.c b/gcc/testsuite/gcc.target/arm/pr42505.c
new file mode 100644
index 00000000000..60902c35d27
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr42505.c
@@ -0,0 +1,23 @@
+/* { dg-options "-mthumb -Os -march=armv5te" } */
+/* { dg-require-effective-target arm_thumb1_ok } */
+/* { dg-final { scan-assembler-not "str\[\\t \]*r.,\[\\t \]*.sp," } } */
+
+struct A {
+ int f1;
+ int f2;
+};
+
+int func(int c);
+
+/* This function should not need to spill anything to the stack. */
+int test(struct A* src, struct A* dst, int count)
+{
+ while (count--) {
+ if (!func(src->f2)) {
+ return 0;
+ }
+ *dst++ = *src++;
+ }
+
+ return 1;
+}