Repository navigation
Closed
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.C-bugCategory: This is a bug.Category: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-asmjsTarget: asm.js - http://asmjs.org/Target: asm.js - http://asmjs.org/O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!P-highHigh priorityHigh priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
On current num-integer master (commit f0e329af1195), rustc nightly and beta both crash when targeting asmjs-unknown-emscripten. Stable is fine.
stable-x86_64-unknown-linux-gnu - rustc 1.39.0 (4560ea788 2019-11-04)
beta-x86_64-unknown-linux-gnu - rustc 1.40.0-beta.1 (76b40532a 2019-11-05)
nightly-x86_64-unknown-linux-gnu - rustc 1.40.0-nightly (3fc30d884 2019-11-10)
$ cargo +stable build --target asmjs-unknown-emscripten
Compiling autocfg v0.1.7
Compiling num-traits v0.2.8
Compiling num-integer v0.1.41 (/home/jistone/rust/num/integer)
Finished dev [unoptimized + debuginfo] target(s) in 2.60s
$ cargo +beta build --target asmjs-unknown-emscripten
Compiling num-integer v0.1.41 (/home/jistone/rust/num/integer)
warning: `#[inline]` is ignored on function prototypes
--> src/lib.rs:260:5
|
260 | #[inline]
| ^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
Referencing function in another module!
call void <badref>(i8* %40), !dbg !50
; ModuleID = '39eosbi6n9pwhhcp'
void (i8*)* <badref>
; ModuleID = '
error: could not compile `num-integer`.
Caused by:
process didn't exit successfully: `rustc --crate-name num_integer src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=795c310a63594098 -C extra-filename=-795c310a63594098 --out-dir /home/jistone/rust/num/integer/target/asmjs-unknown-emscripten/debug/deps --target asmjs-unknown-emscripten -C incremental=/home/jistone/rust/num/integer/target/asmjs-unknown-emscripten/debug/incremental -L dependency=/home/jistone/rust/num/integer/target/asmjs-unknown-emscripten/debug/deps -L dependency=/home/jistone/rust/num/integer/target/debug/deps --extern num_traits=/home/jistone/rust/num/integer/target/asmjs-unknown-emscripten/debug/deps/libnum_traits-2f98a4660a35fd13.rmeta --cfg has_i128` (signal: 11, SIGSEGV: invalid memory reference)
$ cargo +nightly build --target asmjs-unknown-emscripten
Compiling num-integer v0.1.41 (/home/jistone/rust/num/integer)
warning: `#[inline]` is ignored on function prototypes
--> src/lib.rs:260:5
|
260 | #[inline]
| ^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
Referencing function in another module!
call void <badref>(i8* %40), !dbg !50
; ModuleID = '4z4jvx7urdbbg8j3'
void (i8*)* <badref>
; ModuleID = '
error: could not compile `num-integer`.
Caused by:
process didn't exit successfully: `rustc --crate-name num_integer src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=947cae8a7fd914b6 -C extra-filename=-947cae8a7fd914b6 --out-dir /home/jistone/rust/num/integer/target/asmjs-unknown-emscripten/debug/deps --target asmjs-unknown-emscripten -C incremental=/home/jistone/rust/num/integer/target/asmjs-unknown-emscripten/debug/incremental -L dependency=/home/jistone/rust/num/integer/target/asmjs-unknown-emscripten/debug/deps -L dependency=/home/jistone/rust/num/integer/target/debug/deps --extern num_traits=/home/jistone/rust/num/integer/target/asmjs-unknown-emscripten/debug/deps/libnum_traits-1f95a1b3834a3c5f.rmeta --cfg has_i128` (signal: 11, SIGSEGV: invalid memory reference)
(The inline attribute warning is irrelevant to success/failure, but I'll clean that up separately.)
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.C-bugCategory: This is a bug.Category: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-asmjsTarget: asm.js - http://asmjs.org/Target: asm.js - http://asmjs.org/O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!P-highHigh priorityHigh priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Activity
cuviper commentedon Nov 11, 2019
GDB backtrace of the SIGSEGV thread on nightly:
mashedcode commentedon Nov 11, 2019
Thanks @cuviper. Minimal reproducible test case:
pnkfelix commentedon Nov 14, 2019
triage: P-high for now. (but this is a Tier-2 target, so it may get downgraded to P-medium after a few weeks. We will see.)
cuviper commentedon Nov 14, 2019
cc #65251 @tlively @alexcrichton -- the versions correspond to the LLVM change for emscripten.
tlively commentedon Nov 14, 2019
This looks like an error in the LLVM verifier, so there is something wrong with the generated LLVM IR. I think we can rule out a bug in the WebAssembly LLVM backend.
alexcrichton commentedon Nov 15, 2019
Sorry I'm not sure where this would be coming from either.. It's likely due to the upgrade of LLVM for the emscripten target for sure though
Disable Emscripten job
Disable Emscripten job
7 remaining items
tlively commentedon Jan 6, 2020
It looks like this is a use-after-free when LLVM is built in release mode. It is caught earlier by an assertion with a debug build of LLVM, and from the backtrace there it looks like there is indeed a previously-unknown issue with the Emscripten exception lowering pass. We are investigating further now.
tlively commentedon Jan 7, 2020
Fix in LLVM incoming: https://reviews.llvm.org/D72308. Once it merges upstream, I will handle getting it merged to Rust's LLVM fork and from there to rustc.
Update LLVM to fix crash on Emscripten targets
tmandry commentedon Jan 21, 2020
Should be fixed by #68030.
cuviper commentedon Jan 21, 2020
Were you able to verify that? I can still reproduce it with
rustc 1.42.0-nightly (b5a3341f1 2020-01-20).tmandry commentedon Jan 21, 2020
No, I just checked that the patch had landed. Reopening.
tlively commentedon Jan 23, 2020
I thought it had been fixed because the regression test I had locally for it passes. But it turns out the test runner uses
-C opt-level=2by default and the crash now needs-C opt-level=0to be triggered. I will continue looking into this.Update LLVM to fix crash on Emscripten targets
Auto merge of #68525 - tlively:emcc-codegen-sigsegv-66308, r=alexcric…
cuviper commentedon Jan 26, 2020
Confirmed, thanks!