[cfe-dev] testcase for _Bool struct padding [was: crash fix, need help]

Sean Middleditch sean at awesomeplay.com
Mon Dec 10 10:24:02 PST 2007


Here is a test case for the crash.

I looked over the C standard, and it doesn't specify any actual size or
padding requirements for _Bool.  Not much of a surprise.  I'm going to
look at what GCC does, since I figure we want binaries compiled with
clang to work when linked against binaries compiled with gcc on the same
arch/platform.

Note that I'm running on an Linux/amd64.  Not sure if this bug occurs on
other archs.

$ clang -emit-llvm _boolpad.c 

clang: CodeGenTypes.cpp:471:
void<unnamed>::RecordOrganizer::addPaddingFields(unsigned int):
Assertion `(RequiredBits % 8) == 0 && "FIXME Invalid struct layout"'
failed.


On Sun, 2007-12-09 at 16:14 -0500, Sean Middleditch wrote:
> Worked on tracking down the crash I have with my small test app, a.k.a.
> clc.
> 
> The crash is actually a failed assertion at
> RecordOrganizer::addPaddingFields, due to the RequiredBits not being a
> multiple of 8.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: _boolpad.c
Type: text/x-csrc
Size: 129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20071210/e390d7d7/attachment.c>


More information about the cfe-dev mailing list