[llvm] [llvm] Fix __builtin_object_size interaction between Negative Offset … (PR #111827)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 12:59:44 PDT 2024


================
@@ -706,7 +715,11 @@ SizeOffsetAPInt ObjectSizeOffsetVisitor::computeImpl(Value *V) {
   IntTyBits = DL.getIndexTypeSizeInBits(V->getType());
   Zero = APInt::getZero(IntTyBits);
 
+  APInt PrevConstantOffset = ConstantOffset;
+
+  ConstantOffset = ConstantOffset.sextOrTrunc(Offset.getBitWidth()) + Offset;
----------------
serge-sans-paille wrote:

I've moved to a call to `CheckedZextOrTrunc` which bails out in case of failure.

https://github.com/llvm/llvm-project/pull/111827


More information about the llvm-commits mailing list