On Thu, Sep 17, 2020 at 10:05:37AM +0000, David Laight wrote:
The 'red-zone' allows leaf function to use stack memory for locals that is below (ie the wrong side of) the stack pointer.
After looking at
"Figure 3.3: Stack Frame with Base Pointer"
in the x86-64 ABI doc, you're probably right:
0(%rbp) -8(%rbp) ... 0(%rsp) .. red zone -128(%rsp)
i.e., rsp-relative addresses with negative offsets are in the red zone. So it looks like the compiler actually knows very well what's going on here and allocates room on the stack for that 0x8(%rsp) slot.
Good.