]> granicus.if.org Git - clang/commitdiff
Re-add a slightly more general version of the check from r72578; it is
authorEli Friedman <eli.friedman@gmail.com>
Fri, 29 May 2009 19:23:46 +0000 (19:23 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 29 May 2009 19:23:46 +0000 (19:23 +0000)
actually necessary in some obscure cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72585 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp
test/CodeGen/vla.c

index 04661fca471c96cb462aa6c0417bc9822a5bc6b6..1a95e6191573e88b8a9398363cf5f11f17eea75a 100644 (file)
@@ -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 {
index 3666d5ee0d7b618c9331aecaeefdfdd0049d92cb..844e49e72c46aabb67d6a3ed9c3c7a156163608a 100644 (file)
@@ -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];
+}