aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-08-14 20:57:45 +0000
committerDevang Patel <dpatel@apple.com>2009-08-14 20:57:45 +0000
commit5a6bfe35051c1c14b63e1fa103c2cc512dab66b8 (patch)
tree624db6fa09080edc8e2e47b9a24653135703fced /lib/CodeGen/CGDebugInfo.cpp
parent2c2b06e1f349b1e66da11aa081e9564064078db7 (diff)
Do now overflow while calulating upper bound for zero sized array.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79043 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index ee2a94067d..6547434883 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -722,8 +722,9 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty,
QualType EltTy(Ty, 0);
while ((Ty = dyn_cast<ArrayType>(EltTy))) {
uint64_t Upper = 0;
- if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty))
- Upper = CAT->getSize().getZExtValue() - 1;
+ if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(Ty))
+ if (CAT->getSize().getZExtValue())
+ Upper = CAT->getSize().getZExtValue() - 1;
// FIXME: Verify this is right for VLAs.
Subscripts.push_back(DebugFactory.GetOrCreateSubrange(0, Upper));
EltTy = Ty->getElementType();