[llvm-commits] llvm-gcc: fix for PR1332

Duncan Sands baldrick at free.fr
Tue Apr 17 13:29:07 PDT 2007


The testcase:

struct Z { int :1; int :0; int :1; } z;

The zero width field causes the second :1 field
to start at bit 32.  This requires inserting 24 bits
of padding.  For some obscure reason the padding logic
subtracts the number of bits of padding from the new
field size before adding it, meaning that it tries to
add -23 new bits rather than +1, causing an assertion
failure.  With the attached patch struct Z converts to
        %struct.Z = type { i8, [3 x i8], i8 }
Lightly tested.

Ciao,

Duncan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitstuff.diff
Type: text/x-diff
Size: 2495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070417/ef96a0b3/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2007-03-26-ZeroWidthBitfieldAfterPadding.c
Type: text/x-csrc
Size: 78 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070417/ef96a0b3/attachment.c>


More information about the llvm-commits mailing list