a.sidorin added inline comments.

================
Comment at: lib/StaticAnalyzer/Core/RegionStore.cpp:1344
   // This is a signed value, since it's used in arithmetic with signed indices.
-  return svalBuilder.makeIntVal(RegionSize / EleSize, false);
+  return svalBuilder.makeIntVal(RegionSize / EleSize, Ctx.getSignedSizeType());
 }
----------------
ebevhan wrote:
> a.sidorin wrote:
> > I think we should initialize SValBuilder::ArrayIndexTy with 
> > getSignedSizeType() instead of LongLongTy and use 
> > `svalBuilder.getArrayIndexType()` here instead.
> I made the change, but it caused a spurious out of bounds warning in 
> index-type.c for the 32-bit case. Making the type signed means that anything 
> above MAX/2 will break, and the test uses arrays of that size.
Hm, yes. ssize_t is 32-bit on 32-bit targets but our indices can exceed it. 
Even if so, `svalBuilder.getArrayIndexType()` should be fine.


Repository:
  rC Clang

https://reviews.llvm.org/D46944



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to