summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/pr39839.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/arm/pr39839.c')
-rw-r--r--gcc/testsuite/gcc.target/arm/pr39839.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/arm/pr39839.c b/gcc/testsuite/gcc.target/arm/pr39839.c
new file mode 100644
index 000000000..3d353244c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr39839.c
@@ -0,0 +1,24 @@
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-Os -fpic" } */
+/* { dg-final { scan-assembler-not "str\[\\t \]*r.,\[\\t \]*.sp," } } */
+
+struct S
+{
+ int count;
+ char *addr;
+};
+
+void func(const char*, const char*, int, const char*);
+
+/* This function should not need to spill to the stack. */
+void test(struct S *p)
+{
+ int off = p->count;
+ while (p->count >= 0)
+ {
+ const char *s = "xyz";
+ if (*p->addr) s = "pqr";
+ func("abcde", p->addr + off, off, s);
+ p->count--;
+ }
+}