leanprover / lean4

Lean 4 programming language and theorem prover
https://lean-lang.org
Apache License 2.0
4.75k stars 427 forks source link

fix: make the stack handling more robust to sanitizers and `-O3` #6143

Closed eric-wieser closed 6 days ago

eric-wieser commented 1 week ago

This PR should make lean better-behaved around sanitizers, per https://github.com/google/sanitizers/issues/1688. As far as I can tell, https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn#algorithm replaces local variables with heap allocations, and so taking the address of a local is not effective at producing a monotonic measure of stack usage.

The approach used here is the same as the one used by clang.

leanprover-community-bot commented 1 week ago

Mathlib CI status (docs):

eric-wieser commented 1 week ago

I guess this should be changelog-other?

Kha commented 6 days ago

changelog-compiler mentions "runtime", let's go with that :)