[cfe-commits] r101536 - in/cfe/trunk: lib/CodeGen/CGExprConstant.cpp test/CodeGen/decl.c

Nuno Lopes nunoplopes at sapo.pt
Fri Apr 16 14:22:59 PDT 2010


> On Apr 16, 2010, at 2:02 PM, Chris Lattner wrote:
>
>> Author: lattner
>> Date: Fri Apr 16 16:02:32 2010
>> New Revision: 101536
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=101536&view=rev
>> Log:
>> fix a bogus assertion exposed by a recent change: packing the
>> struct may cause it to shrink more than one byte.  Before
>> my recent changes we compiled the new test into:
>>
>> %0 = type { [6 x i8] }
>> @x = global %0 { [6 x i8] undef }, align 2        ; <%0*> [#uses=0]
>>
>> which is obviously bogus.  Now we compile it into:
>>
>> %0 = type <{ i32, i8, i8 }>
>> @x = global %0 zeroinitializer, align 2           ; <%0*> [#uses=0]
>>
>> Where the last byte only is tail padding.
>
> And with Nuno's recent patch, we get:
>
> %0 = type <{ i32, i8, i8 }>
> @x = global %0 <{ i32 0, i8 0, i8 undef }>, align 2 ; <%0*> [#uses=0]
>
> which is even better.

I was actually rebuilding clang to try out your test case. I'm glad clang is 
now doing the right thing :)
BTW, I'm compiling sqlite right now to make sure I don't break anything.

Nuno 




More information about the cfe-commits mailing list