| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
/* Check that sub-word sized elements of structures passed in in |
| 4 |
registers are handled correctly with respect to the current endianness. */ |
| 5 |
|
| 6 |
#include <stdlib.h> |
| 7 |
#include <string.h> |
| 8 |
|
| 9 |
struct s { |
| 10 |
short h; |
| 11 |
char s[8]; |
| 12 |
}; |
| 13 |
|
| 14 |
void |
| 15 |
f (struct s *sp, struct s ss) |
| 16 |
{ |
| 17 |
if (sp->h != ss.h |
| 18 |
|| strcmp (sp->s, ss.s)) |
| 19 |
abort (); |
| 20 |
} |
| 21 |
|
| 22 |
int |
| 23 |
main (void) |
| 24 |
{ |
| 25 |
struct s ss; |
| 26 |
ss.h = 42; |
| 27 |
strcpy (ss.s, "shazam!"); |
| 28 |
f (&ss, ss); |
| 29 |
return 0; |
| 30 |
} |
| 31 |
|