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

Devang Patel dpatel at apple.com
Tue Apr 17 13:36:06 PDT 2007


On Apr 17, 2007, at 1:29 PM, Duncan Sands wrote:

> 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.

I just checked in simpler fix. Need to reduce field size only if
start of field is not at byte boundary.

-
Devang

> 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/b0011091/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/b0011091/attachment.c>
-------------- next part --------------
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list