forked from OSchip/llvm-project
Make sure to cast the VLA size of array to the type of size_t. Fixes PR3442.
llvm-svn: 63394
This commit is contained in:
parent
3b6a4bd891
commit
221483dd4e
|
@ -684,7 +684,10 @@ ScalarExprEmitter::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) {
|
|||
// 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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s
|
||||
|
||||
// PR3442
|
||||
|
||||
static void *g(unsigned long len);
|
||||
|
||||
void
|
||||
f(int n)
|
||||
{
|
||||
unsigned begin_set[n];
|
||||
|
||||
g(sizeof(begin_set));
|
||||
}
|
Loading…
Reference in New Issue