[cfe-commits] r63394 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGen/sizeof-vla.c
Anders Carlsson
andersca at mac.com
Fri Jan 30 19:02:27 PST 2009
30 jan 2009 kl. 09.31 skrev Eli Friedman:
> On Fri, Jan 30, 2009 at 8:41 AM, Anders Carlsson <andersca at mac.com>
> wrote:
>> @@ -684,7 +684,10 @@
>> // sizeof(type) - make sure to emit the VLA size.
>> CGF.EmitVLASize(TypeToSize);
>> }
>> - return CGF.GetVLASize(VAT);
>> +
>> + llvm::Value *VLASize = CGF.GetVLASize(VAT);
>> + return Builder.CreateIntCast(VLASize, ConvertType(E-
>> >getType()),
>> + false, "conv");
>> }
>> }
>
> This seems like a relatively late place to put the cast; we should be
> computing the size in type size_t, I think. Are you sure there isn't
> a missing cast earlier?
>
> -Eli
Hmm, yeah - we could probably add an implicit cast to the size_t type
for the VLA size expr. Not sure what something like
int a[(unsigned long long)f()]
would do in 32-bit, but given that the alloca instruction only takes a
32-bit constant that isn't an issue anyway :)
What do you think?
Anders
More information about the cfe-commits
mailing list