| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -fno-inline" } */ |
| 3 |
|
| 4 |
/* Test pass-by-reference and pointer-typed argument passing on stack. |
| 5 |
This test shall pass on any of the following four combinitions: |
| 6 |
{big-endian, little-endian} {LP64, ILP32}. */ |
| 7 |
|
| 8 |
struct s5 |
| 9 |
{ |
| 10 |
double a; |
| 11 |
double b; |
| 12 |
double c; |
| 13 |
double d; |
| 14 |
double e; |
| 15 |
} gS = {1.0, 2.0, 3.0, 4.0, 5.0}; |
| 16 |
|
| 17 |
double __attribute__ ((noinline)) |
| 18 |
foo (struct s5 p1, struct s5 p2, struct s5 p3, struct s5 p4, |
| 19 |
struct s5 p5, struct s5 p6, struct s5 p7, struct s5 p8, |
| 20 |
struct s5 p9) |
| 21 |
{ |
| 22 |
asm (""); |
| 23 |
return p9.c; |
| 24 |
} |
| 25 |
|
| 26 |
void abort (void); |
| 27 |
int printf (const char *, ...); |
| 28 |
|
| 29 |
int main (void) |
| 30 |
{ |
| 31 |
printf ("Here we print out some values and more importantly hope that" |
| 32 |
" the stack is getting a bit dirty for the bug to manifest itself" |
| 33 |
"\n\t%f, %f, %f, %f, %f\n", gS.a, gS.b, gS.c, gS.d, gS.e); |
| 34 |
|
| 35 |
if (foo (gS, gS, gS, gS, gS, gS, gS, gS, gS) != 3.0) |
| 36 |
abort (); |
| 37 |
|
| 38 |
return 0; |
| 39 |
} |