-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Targets: wasm32-unknown-unknown
, wasm32-wasi
When calling core::arch::wasm32::unreachable()
, the generated WASM contains two unreachable
instructions instead of only one.
Example:
pub fn main(){
core::arch::wasm32::unreachable();
}
Output (from Godbolt):
example::main:
unreachable
unreachable
end_function
Godbolt link: https://rust.godbolt.org/z/Yqz6Kh9eq
This is mostly noticeable when using build-std-features=panic_immediate_abort
(which I know is unstable), as all instances of panic!()
are basically replaced with unreachable()
, and then compile down to two unreachable
instructions.
This behavior appears to have been present since core::arch::wasm32::unreachable()
was made available, so this is not a regression.
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.