blob: a2d665ea74179915e05c65ebca9271e8c5ad469c [file] [log] [blame]
Daniel Dunbar1faf5ba2009-05-13 21:34:08 +00001// RUN: clang-cc -triple i686-apple-darwin9 %s -fsyntax-only -verify
2
3// Stack: [], Alignment: 8
4
5#pragma pack(push, 1)
6// Stack: [8], Alignment: 1
7
8#pragma pack(push, 4)
9// Stack: [8, 1], Alignment: 4
10
11// Note that this differs from gcc; pack() in gcc appears to pop the
12// top stack entry and resets the current alignment. This is both
13// inconsistent with MSVC, and the gcc documentation. In other cases,
14// for example changing this to pack(8), I don't even understand what gcc
15// is doing.
16
17#pragma pack()
18// Stack: [8, 1], Alignment: 8
19
20#pragma pack(pop)
21// Stack: [8], Alignment: 1
22struct s0 {
23 char f0;
24 short f1;
25};
26int a[sizeof(struct s0) == 3 ? 1 : -1];
27
28#pragma pack(pop)
29// Stack: [], Alignment: 8
30struct s1 {
31 char f0;
32 short f1;
33};
34int b[sizeof(struct s1) == 4 ? 1 : -1];