llvm-project
222e661c - [clang][layout] Fix unsigned char overflow in ms_struct bitfield layout (#181433)

Commit
67 days ago
[clang][layout] Fix unsigned char overflow in ms_struct bitfield layout (#181433) Fixes #161511 When using MS-struct layout rules (`#pragma ms_struct`), Clang produces incorrect memory layouts when encountering large `_BitInt` bit-fields. The reason was that `LastBitfieldStorageUnitSize` variable was declared as `unsigned char`, which caused it to overflow when the values used with `_BitInt` exceeded `255`, so I changed it from `unsigned char` to `uint64_t`. In the added test, we can clearly see that `f2` and `f3` are both packed in the same 256-bit unit.
Author
Parents
Loading