[llvm] [llvm] Fix __builtin_object_size interaction between Negative Offset … (PR #111827)
Harald van Dijk via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 13 13:40:18 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;
----------------
hvdijk wrote:
Is it safe to possibly truncate here? The below bit with `IndexTypeSizeChanged` tries to very carefully handle the possibility that pointers (and hence indices on those pointers) have different sizes, it's a bit hard to see how exactly that should be handled here.
https://github.com/llvm/llvm-project/pull/111827
More information about the llvm-commits
mailing list