On Wed, Jun 6, 2012 at 4:09 PM, Eli Friedman <[email protected]> wrote:
> On Wed, Jun 6, 2012 at 3:58 PM, Fariborz Jahanian <[email protected]> wrote:
>> Author: fjahanian
>> Date: Wed Jun  6 17:58:50 2012
>> New Revision: 158117
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=158117&view=rev
>> Log:
>> When doing arithmatic on vla pointer, make sure
>> to emit vla size to prevent an irgen crash.
>> // rdar://11485774
>>
>> Modified:
>>    cfe/trunk/lib/CodeGen/CGExprScalar.cpp
>>    cfe/trunk/test/CodeGen/vla.c
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=158117&r1=158116&r2=158117&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jun  6 17:58:50 2012
>> @@ -1970,6 +1970,9 @@
>>   QualType elementType = pointerType->getPointeeType();
>>   if (const VariableArrayType *vla
>>         = CGF.getContext().getAsVariableArrayType(elementType)) {
>> +    // arithmatic on VLA pointer - make sure to emit the VLA size.
>> +    CGF.EmitVariablyModifiedType(elementType);
>
> This call is in the wrong place; we should emit the type of an
> InitListExpr when we emit the expression itself, not when we use it.

Err, not the InitListExpr; the CompoundLiteralExpr, like John said.

-Eli

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to