-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIGSEGV when compiling for wasm #60540
Comments
Got backtraces for all thread by loading a core dump:
|
After trying compiling it many times it does succeed, but the resulting wasm file is corrupt: |
Based on ^-- I'm tentatively labeling as a soundness hole since it seems that type preservation is violated? (Haven't looked closely) |
Reduced repro: $ rustc lib.rs --crate-type lib --target wasm32-unknown-wasi lib.rs#![allow(unused_variables)]
type ExpInt = i16;
type Limb = u128;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Loss {
ExactlyZero,
}
fn shift_left(dst: &mut [Limb], exp: &mut ExpInt, bits: usize) {
loop {}
}
fn shift_right(dst: &mut [Limb], exp: &mut ExpInt, bits: usize) -> Loss {
loop {}
}
fn sub(a: &mut [Limb], b: &[Limb], c: Limb) -> Limb {
loop {}
}
pub fn add_or_sub(
a_sig: &mut [Limb],
a_exp: &mut ExpInt,
a_sign: &mut bool,
b_sig: &mut [Limb],
b_exp: ExpInt,
b_sign: bool,
) {
let bits = *a_exp - b_exp;
let (reverse, loss);
if bits == 0 {
loop {}
} else if bits > 0 {
loss = shift_right(b_sig, &mut 0, (bits - 1) as usize);
shift_left(a_sig, a_exp, 1);
reverse = false;
} else {
loss = shift_right(a_sig, a_exp, (-bits - 1) as usize);
shift_left(b_sig, &mut 0, 1);
reverse = true;
}
let borrow = (loss != Loss::ExactlyZero) as Limb;
if reverse {
assert_eq!(sub(b_sig, a_sig, borrow), 0);
}
} Edit: Reduced it even more. |
I've got a bit more specific one from Node.js:
|
LLVM IR for @bjorn3's reproducer: https://gist.github.com/nikic/fb45d54844f6feb698a309418e948866 Running this through
With backtrace:
|
Reduced test case:
|
Upstream report: https://bugs.llvm.org/show_bug.cgi?id=41841 |
Fixed upstream: llvm/llvm-project@323dc63 |
More details can be found in rust-lang#60540! Closes rust-lang#60540
…=nikic Update LLVM to fix assertion when compiling to wasm More details can be found in rust-lang#60540! Closes rust-lang#60540
Unfortunately I can't get a backtrace as running inside a debugger prevents it from crashing.
Reproduction:
Clone https://github.com/bjorn3/rust. Checkout commit 8c17e4aec8e187addf8fc187b64bd411a6038dea and follow the instructions on the top of the readme. Sometimes the execution succeeds, so you may have to remove the
target
dir when it succeeded.The text was updated successfully, but these errors were encountered: