-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
ABIApplication Binary InterfaceApplication Binary InterfaceclangClang issues not falling into any other categoryClang issues not falling into any other categoryconfirmedVerified by a second partyVerified by a second party
Description
Due to an overflow in
unsigned char LastBitfieldStorageUnitSize;
in ItaniumRecordLayoutBuilder there could be wrong packing of ms-bitfields.
When the storage size 256 is stored in LastBitfieldStorageUnitSize this will be zero and a new type is opened for storage of the next field.
Code:
#pragma ms_struct on
// Error! struct a will be layout in two i256
// Due to an overflow in
// unsigned char LastBitfieldStorageUnitSize;
// in ItaniumRecordLayoutBuilder
// when storage size 256 is assigned -> zero.
// f3 will be packed in a new i256:
struct { _BitInt(250) f2 : 2; _BitInt(250) f3 : 2; } __attribute__((packed, aligned(1))) a;
// Ok! f2 and f3 are packed in the same type:
struct { _BitInt(192) f2 : 2; _BitInt(192) f3 : 2; } __attribute__((packed, aligned(1))) b;
// Ok! f2 and f3 are packed in the same type:
struct { _BitInt(128) f2 : 64; _BitInt(128) f3 : 64; } __attribute__((packed, aligned(1))) c;Command line args:
-Xclang -fms-extensions -Xclang -fdump-record-layouts Metadata
Metadata
Assignees
Labels
ABIApplication Binary InterfaceApplication Binary InterfaceclangClang issues not falling into any other categoryClang issues not falling into any other categoryconfirmedVerified by a second partyVerified by a second party