[cfe-commits] r79043 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Devang Patel dpatel at apple.com
Fri Aug 14 13:57:45 PDT 2009


Author: dpatel
Date: Fri Aug 14 15:57:45 2009
New Revision: 79043

URL: http://llvm.org/viewvc/llvm-project?rev=79043&view=rev
Log:
Do now overflow while calulating upper bound for zero sized array.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=79043&r1=79042&r2=79043&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Aug 14 15:57:45 2009
@@ -722,8 +722,9 @@
   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();





More information about the cfe-commits mailing list