[llvm] [llvm] Bail out when meeting pointer with negative offset instead of … (PR #120424)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 07:13:46 PST 2024


================
@@ -841,8 +841,7 @@ OffsetSpan ObjectSizeOffsetVisitor::computeImpl(Value *V) {
     // This is UB, and we'd rather return an empty location then.
     if (Options.EvalMode == ObjectSizeOpts::Mode::Min ||
         Options.EvalMode == ObjectSizeOpts::Mode::Max) {
-      ORT.Before = APInt::getZero(ORT.Before.getBitWidth());
-      ORT.After = APInt::getZero(ORT.Before.getBitWidth());
+      return ObjectSizeOffsetVisitor::unknown();
----------------
fhahn wrote:

Is the comment above incorrect? IIUC the case  @mstorsjo shared doesn't count UB

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


More information about the llvm-commits mailing list