summaryrefslogtreecommitdiffstats
path: root/clang/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
commitd4bbb089464d77d0241a9c8d7a7a744046bfb896 (patch)
tree5f9aa14fb1fb9a2e07c18de3e501e58ef0043388 /clang/lib/CodeGen/CGDebugInfo.cpp
parent026d201ecac7506c64e0997bd95e3174c180c6de (diff)
downloadbcm5719-llvm-d4bbb089464d77d0241a9c8d7a7a744046bfb896.tar.gz
bcm5719-llvm-d4bbb089464d77d0241a9c8d7a7a744046bfb896.zip
Do now overflow while calulating upper bound for zero sized array.
llvm-svn: 79043
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index ee2a94067d3..65474348834 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud