Skip to content

bit field struct is wrong size when compiled with wpp386 but not wcc386 #1562

@ideafarm

Description

@ideafarm

struct
{
unsigned long long ii1 : 24 ;
unsigned long long ii2 : 24 ;
unsigned long long ii3 : 9 ;
}
foo ;

unsigned c1 = sizeof foo ;

int main( void )
{
return 0 ;
}


wpp386 -d2 -zp1 bench.cpp -q
wcc386 -d2 -zp1 bench.c -q

when compiled with wcc386, sizeof foo is 8 (correct).
when compiled with wpp386, sizeof foo is 0xc (wrong).
OW2 is at commit 83fb416, which is 3 commits behind current as of this writing.

Priority: This bug affects code that uses Windows structure MIB_UNICASTIPADDRESS_ROW, such as CreateUnicastIpAddressEntry(). (See the member InterfaceLuid.) The likely impact of this bug is that any structure (or class or union) that contains a bit field of the type unsigned long long will have members misaligned, which will generally be fatal if the structure is used to communicate with an operating system api.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C++C++ compilerbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions