| 1 |
/* { dg-do run { target powerpc*-*-linux* powerpc*-*-eabi* powerpc-*-rtems* } } */ |
| 2 |
/* { dg-options {} } */ |
| 3 |
|
| 4 |
/* Test stack pointer alignment against variable alloca. */ |
| 5 |
/* Inspired by PR libgcj/10610. */ |
| 6 |
/* Origin: Franz Sirl <[email protected]>. */ |
| 7 |
|
| 8 |
extern void abort (void); |
| 9 |
extern void exit (int); |
| 10 |
|
| 11 |
register unsigned long sp __asm__ ("r1"); |
| 12 |
|
| 13 |
void g (int * val __attribute__ ((unused))) |
| 14 |
{ |
| 15 |
if (sp & 0xf) |
| 16 |
abort (); |
| 17 |
} |
| 18 |
|
| 19 |
void f (int val) |
| 20 |
{ |
| 21 |
int *val1 = __builtin_alloca (val); |
| 22 |
|
| 23 |
g (val1); |
| 24 |
return; |
| 25 |
} |
| 26 |
|
| 27 |
int main (void) |
| 28 |
{ |
| 29 |
int i; |
| 30 |
|
| 31 |
for (i = 1; i < 32; i++) |
| 32 |
f (i); |
| 33 |
|
| 34 |
exit (0); |
| 35 |
} |