https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn#compatibility currently says:
The fake stack may be incompatible with some low-level code that uses certain assumptions about the stack memory layout.
- Code that takes an address of a local variable and assumes the variable is localed on the real stack.
I think it is worth mentioning here the workarounds which some projects have used to allow such code continue working under ASan’s use-after-return detection:
https://github.com/llvm/llvm-project/blob/llvmorg-10.0.0-rc1/clang/lib/Basic/Stack.cpp#L24 seems like a neat example of this. For added portability, those borrowing it may also want to preface it with:
#ifndef __has_builtin
#define __has_builtin(x) 0 /* for non-clang compilers */
#endif
as suggested by https://clang.llvm.org/docs/LanguageExtensions.html#has-builtin