Uh oh!
There was an error while loading. Please reload this page.
Don't spill operands onto the stack in naked functions - #75417
Conversation
This reverts commit 2567074. This commit does not actually fix the problem. It merely removes the name of the argument from the LLVM output. Even without the name, Rust codegen still spills the (nameless) variable onto the stack which is the root cause. The root cause is solved in the next commit.
Currently, the code spills operands onto the stack for the purpose of debuginfo. However, naked functions can only contain an asm block. Therefore, attempting to spill the operands on the stack is undefined behavior. Fixesrust-lang#42779 cc rust-lang#32408
rust-highfive
commented
Aug 11, 2020
r? @oli-obk (rust_highfive has picked a reviewer for you, use r? to override) |
npmccallum
commented
Aug 11, 2020
Amanieu
commented
Aug 11, 2020
Actually we need something even stronger here: we must never emit an |
npmccallum
commented
Aug 11, 2020
I agree. However, that should not block this fix, which is needed either way (and currently blocks my day job). |
matthewjasper
commented
Aug 13, 2020
@bors r+ |
bors
commented
Aug 13, 2020
📌 Commit 050fb38 has been approved by |
Rollup of 12 pull requests Successful merges: - rust-lang#74650 (Correctly parse `{} && false` in tail expression) - rust-lang#75319 (Fix ICE rust-lang#75307 in `format`) - rust-lang#75417 (Don't spill operands onto the stack in naked functions) - rust-lang#75452 (self-profile: Cache more query key strings when doing self-profiling.) - rust-lang#75459 (fix LocalInfo doc comment) - rust-lang#75462 (Remove unused tcx parameter) - rust-lang#75467 (Fix E0741 error code explanation) - rust-lang#75471 (Change registered "program name" for -Cllvm-args usage messages) - rust-lang#75477 (Expand function pointer docs) - rust-lang#75479 (make rustc-docs component available to rustup) - rust-lang#75496 (Prioritization WG: Open Zulip topics only for `I-prioritize` issues) - rust-lang#75500 (Disable zlib in LLVM on aarch64-apple-darwin) Failed merges: r? @ghost
Requires this fix: rust-lang/rust#75417
Currently, the code spills operands onto the stack for the purpose of
debuginfo. However, naked functions can only contain an asm block. Therefore,
attempting to spill the operands on the stack is undefined behavior.
Fixes#42779
cc #32408
Note that this PR reverts #74105 which ultimately didn't fix the problem.
cc @haraldh@Amanieu@matthewjasper