| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
/* Check that a structure argument passed partially in registers and |
| 4 |
partially on the stack works. */ |
| 5 |
|
| 6 |
#include <stdlib.h> |
| 7 |
#include <string.h> |
| 8 |
|
| 9 |
struct s { |
| 10 |
unsigned int i; |
| 11 |
double d; |
| 12 |
char s[16]; |
| 13 |
}; |
| 14 |
|
| 15 |
/* Note specifically that, since there are 4 argument registers, the |
| 16 |
value of ss.d is split between the last argument register and the |
| 17 |
stack. */ |
| 18 |
void |
| 19 |
f (struct s *sp, int j, struct s ss, int k) |
| 20 |
{ |
| 21 |
if (sp->i != ss.i |
| 22 |
|| sp->d != ss.d |
| 23 |
|| strcmp (sp->s, ss.s)) |
| 24 |
abort (); |
| 25 |
if (j != -k) |
| 26 |
abort (); |
| 27 |
} |
| 28 |
|
| 29 |
int |
| 30 |
main (void) |
| 31 |
{ |
| 32 |
struct s ss; |
| 33 |
ss.i = 0xdeadbeef; |
| 34 |
ss.d = 2.71828; |
| 35 |
strcpy (ss.s, "shazam!"); |
| 36 |
f (&ss, 42, ss, -42); |
| 37 |
return 0; |
| 38 |
} |