Fix crash in StoreManager::CastRegion() when the base region is a type with 0 size.

llvm-svn: 100594
diff --git a/clang/lib/Checker/Store.cpp b/clang/lib/Checker/Store.cpp
index e524cb3..80b6586 100644
--- a/clang/lib/Checker/Store.cpp
+++ b/clang/lib/Checker/Store.cpp
@@ -170,13 +170,14 @@
       if (IsCompleteType(Ctx, PointeeTy)) {
         // Compute the size in **bytes**.
         CharUnits pointeeTySize = Ctx.getTypeSizeInChars(PointeeTy);
-
-        // Is the offset a multiple of the size?  If so, we can layer the
-        // ElementRegion (with elementType == PointeeTy) directly on top of
-        // the base region.
-        if (off % pointeeTySize == 0) {
-          newIndex = off / pointeeTySize;
-          newSuperR = baseR;
+        if (!pointeeTySize.isZero()) {
+          // Is the offset a multiple of the size?  If so, we can layer the
+          // ElementRegion (with elementType == PointeeTy) directly on top of
+          // the base region.
+          if (off % pointeeTySize == 0) {
+            newIndex = off / pointeeTySize;
+            newSuperR = baseR;
+          }
         }
       }