summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp2
-rw-r--r--clang/test/CodeGen/vla.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 04661fca471..1a95e619157 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -487,6 +487,8 @@ llvm::Value *CodeGenFunction::EmitVLASize(QualType Ty)
}
return SizeEntry;
+ } else if (const ArrayType *AT = dyn_cast<ArrayType>(Ty)) {
+ EmitVLASize(AT->getElementType());
} else if (const PointerType *PT = Ty->getAsPointerType())
EmitVLASize(PT->getPointeeType());
else {
diff --git a/clang/test/CodeGen/vla.c b/clang/test/CodeGen/vla.c
index 3666d5ee0d7..844e49e72c4 100644
--- a/clang/test/CodeGen/vla.c
+++ b/clang/test/CodeGen/vla.c
@@ -29,3 +29,9 @@ f(int count)
if (a[0] != 3) {
}
}
+
+void g(int count) {
+ // Make sure we emit sizes correctly in some obscure cases
+ int (*a[5])[count];
+ int (*b)[][count];
+}
OpenPOWER on IntegriCloud