diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-05-29 19:23:46 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-05-29 19:23:46 +0000 |
commit | bdad6b69f1214fb20116795f8e8cbf881e3017c6 (patch) | |
tree | ccadfb5ce7691fb01bc1e0889b22f1fe5e7e499b | |
parent | c9bb1b8e4e6d46ce6c9691dc72757f2a8f71b57b (diff) |
Re-add a slightly more general version of the check from r72578; it is
actually necessary in some obscure cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72585 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 2 | ||||
-rw-r--r-- | test/CodeGen/vla.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 04661fca47..1a95e61915 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/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/test/CodeGen/vla.c b/test/CodeGen/vla.c index 3666d5ee0d..844e49e72c 100644 --- a/test/CodeGen/vla.c +++ b/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]; +} |