Description
See this godbolt link.
At line 177 of the generated assembly, it loads the address rsp + 176
and passes it to the core::fmt::ArgumentV1::new_debug
function. The offset 176 is incorrect since the data pushed to the stack in lines 166-175, the 40-byte stack frame pushed during the interrupt, and the 8-byte error code are only 128 bytes total, so the address will point to something random below the interrupt stack frame on the stack.
This does not occur if the error code argument is removed: see godbolt. Here, an additional sub rsp, 80
instruction appears at line 175 after saving registers, and the offset used at line 177 is correct (skipping the 80 bytes plus the 72 from the 9 saved registers, for 152 bytes total).
Experimenting with custom target JSON specifications instead of x86_64-unknown-none, it appears that the bug disappears when the "stack-probes": {"kind": "inline-or-call", ...}
part of the specification is removed.