| 1 |
/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ |
| 2 |
|
| 3 |
/* Disable this test for 16-bit targets. */ |
| 4 |
|
| 5 |
#include <limits.h> |
| 6 |
|
| 7 |
#if !(defined __GNUC__) || (INT_MAX > 32767) |
| 8 |
|
| 9 |
#include "compat-common.h" |
| 10 |
#include "struct-align-2.h" |
| 11 |
|
| 12 |
#define TEST(NAME) \ |
| 13 |
struct outer_##NAME { \ |
| 14 |
int i; \ |
| 15 |
struct epoll_event_##NAME ee; \ |
| 16 |
}; \ |
| 17 |
\ |
| 18 |
extern unsigned int v1_##NAME; \ |
| 19 |
extern unsigned int v2_##NAME; \ |
| 20 |
extern unsigned long long v3_##NAME; \ |
| 21 |
\ |
| 22 |
extern struct outer_##NAME s_##NAME[2]; \ |
| 23 |
\ |
| 24 |
extern void pass_##NAME (struct outer_##NAME); \ |
| 25 |
extern struct outer_##NAME return_##NAME (void); \ |
| 26 |
\ |
| 27 |
void \ |
| 28 |
checkp_##NAME (struct outer_##NAME *p) \ |
| 29 |
{ \ |
| 30 |
if (p->i != v1_##NAME) \ |
| 31 |
DEBUG_CHECK; \ |
| 32 |
if (p->ee.events != v2_##NAME) \ |
| 33 |
DEBUG_CHECK; \ |
| 34 |
if (p->ee.data != v3_##NAME) \ |
| 35 |
DEBUG_CHECK; \ |
| 36 |
} \ |
| 37 |
\ |
| 38 |
void \ |
| 39 |
test_##NAME (void) \ |
| 40 |
{ \ |
| 41 |
struct outer_##NAME s; \ |
| 42 |
DEBUG_FPUTS (DESC_##NAME); \ |
| 43 |
DEBUG_NL; \ |
| 44 |
DEBUG_FPUTS (" global array"); \ |
| 45 |
checkp_##NAME (&s_##NAME[0]); \ |
| 46 |
checkp_##NAME (&s_##NAME[1]); \ |
| 47 |
DEBUG_NL; \ |
| 48 |
DEBUG_FPUTS (" argument"); \ |
| 49 |
pass_##NAME (s_##NAME[0]); \ |
| 50 |
DEBUG_NL; \ |
| 51 |
DEBUG_FPUTS (" function result"); \ |
| 52 |
s = return_##NAME (); \ |
| 53 |
checkp_##NAME (&s); \ |
| 54 |
DEBUG_NL; \ |
| 55 |
} |
| 56 |
|
| 57 |
TEST (orig) |
| 58 |
#ifndef SKIP_ATTRIBUTE |
| 59 |
TEST (structmax) |
| 60 |
TEST (struct4) |
| 61 |
TEST (struct8) |
| 62 |
TEST (data4) |
| 63 |
TEST (data8) |
| 64 |
TEST (p) |
| 65 |
TEST (pstruct4) |
| 66 |
TEST (pstruct8) |
| 67 |
TEST (pdata4) |
| 68 |
TEST (pdata8) |
| 69 |
#endif |
| 70 |
|
| 71 |
#else |
| 72 |
|
| 73 |
int i; /* prevent compiling an empty file */ |
| 74 |
|
| 75 |
#endif /* INT_MAX */ |