]>
Commit | Line | Data |
---|---|---|
24a57808 | 1 | /* Prove that pragma alignment handling works somewhat. */ |
a5de05b7 | 2 | |
5c318df5 | 3 | /* { dg-do run { target { ! default_packed } } } */ |
a5de05b7 | 4 | |
ee712eab JM |
5 | extern void abort (void); |
6 | ||
a5de05b7 RL |
7 | struct { |
8 | char one; | |
9 | long two; | |
10 | } defaultalign; | |
11 | ||
d48b4987 EB |
12 | #if defined(__LP64__) |
13 | #pragma pack(8) | |
14 | #else | |
a5de05b7 | 15 | #pragma pack(4) |
d48b4987 | 16 | #endif |
a5de05b7 RL |
17 | struct { |
18 | char one; | |
19 | long two; | |
20 | } sixteen; | |
21 | ||
22 | #pragma pack(1) | |
23 | struct { | |
24 | char one; | |
25 | long two; | |
26 | } two; | |
27 | ||
28 | #pragma pack(2) | |
29 | struct { | |
30 | char one; | |
31 | long two; | |
32 | } three; | |
33 | ||
34 | #pragma pack() | |
35 | struct { | |
36 | char one; | |
37 | long two; | |
38 | } resetalign; | |
39 | ||
40 | main() | |
41 | { | |
42 | if(sizeof(sixteen) < sizeof(defaultalign)) abort(); | |
43 | if(sizeof(two) >= sizeof(defaultalign)) abort(); | |
44 | if(sizeof(three) <= sizeof(two)) abort(); | |
45 | if(sizeof(resetalign) != sizeof(defaultalign)) abort(); | |
c82fd9b8 | 46 | return 0; |
a5de05b7 | 47 | } |