Files
llvm-project/clang/test/CodeGen/ms_struct-packed.c
Fangrui Song da3efc79f0 Fix packed being ignored on ms_struct bitfields (#182792)
For ms_struct structs on Itanium layout targets, the packed attribute is
ignored on bit-fields (2014 commit
76e1818a2b), mismatching the GCC behavior.
Remove the `!IsMsStruct` guard to fix it.
2026-03-11 18:17:43 -07:00

19 lines
465 B
C

// RUN: %clang_cc1 -emit-llvm-only -triple x86_64 %s
/// Packed struct: different storage unit types should pack without alignment
/// padding between storage units.
struct __attribute__((packed,ms_struct)) P1 {
short a : 8;
int b : 30;
};
static int p1[(sizeof(struct P1) == 6) ? 1 : -1];
// Packed struct with char and int fields.
struct [[gnu::ms_struct,gnu::packed]] P2 {
char a : 4;
int b : 20;
};
static int p2[(sizeof(struct P2) == 5) ? 1 : -1];