diff options
author | Kaelyn Uhrain <rikka@google.com> | 2011-08-10 19:47:25 +0000 |
---|---|---|
committer | Kaelyn Uhrain <rikka@google.com> | 2011-08-10 19:47:25 +0000 |
commit | d10f4bc5a05ce0cdc1646dbb0f706bb9d3dfc0c5 (patch) | |
tree | 37a06c012655f3a63426600b5b3892ce6982db2e /lib/Sema/SemaChecking.cpp | |
parent | 18f169770d9d3f826bad8f1359c8c5770c5ab16f (diff) |
Add a test case for the divide-by-zero fix in r137234
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index d1fa196569..94e1c4f331 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -3553,6 +3553,7 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr, // Make sure we're comparing apples to apples when comparing index to size uint64_t ptrarith_typesize = Context.getTypeSize(EffectiveType); uint64_t array_typesize = Context.getTypeSize(BaseType); + // Handle ptrarith_typesize being zero, such as when casting to void* if (!ptrarith_typesize) ptrarith_typesize = 1; if (ptrarith_typesize != array_typesize) { // There's a cast to a different size type involved |