summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/pr39839.c
blob: 3d353244c765cba91613aa3e70ae1ecb6f6d45c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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--;
    }
}