brintos

brintos / llvm-project-archived public Read only

0
0
Text · 820 B · e7a6cee Raw
36 lines · c
1// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify2// expected-no-diagnostics3 4// Stack: [], Alignment: 85 6#pragma pack(push, 1)7// Stack: [8], Alignment: 18 9#pragma pack(push, 4)10// Stack: [8, 1], Alignment: 411 12// Note that this differs from gcc; pack() in gcc appears to pop the13// top stack entry and resets the current alignment. This is both14// inconsistent with MSVC, and the gcc documentation. In other cases,15// for example changing this to pack(8), I don't even understand what gcc16// is doing.17 18#pragma pack()19// Stack: [8, 1], Alignment: 820 21#pragma pack(pop)22// Stack: [8], Alignment: 123struct s0 {24  char f0;25  short f1;26};27int a[sizeof(struct s0) == 3 ? 1 : -1];28 29#pragma pack(pop)30// Stack: [], Alignment: 831struct s1 {32  char f0;33  short f1;34};35int b[sizeof(struct s1) == 4 ? 1 : -1];36