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

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 17:19:08 PDT 2024


hvdijk wrote:

I'm still a bit wary: since this relies on the offset being known, since we get incorrect results if the offset isn't known, it suggests to me that if we ever end up in `ObjectSizeOffsetEvaluator::visitGEPOperator` for a non-constant offset, where that then calls `compute_(GEP.getPointerOperand())` where `compute_` first tries to get a result via `ObjectSizeOffsetVisitor`, that `ObjectSizeOffsetVisitor` could still return an incorrect result. I cannot come up with a test case where this actually fails though.

At the same time, this PR looks to me like it makes things strictly better: if there are cases that get mishandled, they would already get mishandled even in current LLVM. So even if we end up remaining unsure that this fix is complete, it may still be fine to merge.

I would appreciate it if someone more familiar with this code could also take a look, but if no one does in a reasonable time, I think merging this should be okay, thanks.

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


More information about the llvm-commits mailing list