[llvm] [StackSafetyAnalysis] Don't call getTruncateOrZeroExtend for pointers of different sizes (PR #79804)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 03:16:29 PST 2024


nikic wrote:

When trying to fix *that* it turns out that StackSafetyAnalysis assumes that all accesses it doesn't visit are "safe". For example, in
```llvm
define void @indirect(ptr %p) {
entry:
  %a = alloca ptr
  store ptr %p, ptr %a
  %v = load ptr, ptr %a
  store i32 0, ptr %v
  ret void
}     
```
the last store is considered "safe" even though it obviously isn't. Apparently the reason why this doesn't miscompile everything is that asan will only use stackAccessIsSafe() if findAllocaForValue() also succeeds.

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


More information about the llvm-commits mailing list