| 1 |
/* { dg-require-effective-target fpic } */ |
| 2 |
/* { dg-options "-Os -fpic" } */ |
| 3 |
/* { dg-final { scan-assembler-not "str\[\\t \]*r.,\[\\t \]*.sp," } } */ |
| 4 |
|
| 5 |
struct S |
| 6 |
{ |
| 7 |
int count; |
| 8 |
char *addr; |
| 9 |
}; |
| 10 |
|
| 11 |
void func(const char*, const char*, int, const char*); |
| 12 |
|
| 13 |
/* This function should not need to spill to the stack. */ |
| 14 |
void test(struct S *p) |
| 15 |
{ |
| 16 |
int off = p->count; |
| 17 |
while (p->count >= 0) |
| 18 |
{ |
| 19 |
const char *s = "xyz"; |
| 20 |
if (*p->addr) s = "pqr"; |
| 21 |
func("abcde", p->addr + off, off, s); |
| 22 |
p->count--; |
| 23 |
} |
| 24 |
} |