[cfe-commits] r137234 - /cfe/trunk/lib/Sema/SemaChecking.cpp
Kaelyn Uhrain
rikka at google.com
Wed Aug 10 11:49:28 PDT 2011
Author: rikka
Date: Wed Aug 10 13:49:28 2011
New Revision: 137234
URL: http://llvm.org/viewvc/llvm-project?rev=137234&view=rev
Log:
Make sure ptrarith_typesize is at least 1 to avoid division by zero
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=137234&r1=137233&r2=137234&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Aug 10 13:49:28 2011
@@ -3553,6 +3553,7 @@
// 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);
+ if (!ptrarith_typesize) ptrarith_typesize = 1;
if (ptrarith_typesize != array_typesize) {
// There's a cast to a different size type involved
uint64_t ratio = array_typesize / ptrarith_typesize;
More information about the cfe-commits
mailing list