Open
Description
cargo build
for a simple hello world program gives seg fault when built in sdk environment using poky sources.
This was first observed in rustc v1.78 and continued in v1.79 and v1.80 also.
(Note: There's no change in the process of sdk build env when tested between the versions).
rustc --version --verbose
:
rustc 1.79.0 (129f3b996 2024-06-10) (built from a source tarball)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-pokysdk-linux-gnu
release: 1.79.0
LLVM version: 18.1.7
Error output
error: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.79.0 (129f3b996 2024-06-10) (built from a source tarball) running on x86_64-pokysdk-linux-gnu
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: rustc interrupted by SIGSEGV, printing backtrace
The backtrace generated is same for with "RUST_BACKTRACE=1" and "RUST_BACKTRACE=full".
I suspect the following out of bounds index access is the main reason for seg fault here.
at compiler/rustc_metadata/src/creader.rs:193:31:
index out of bounds: the len is 20 but the index is 60747757
fbc9b94 and 0025c9c are the recent commits related to this.
Maybe @oli-obk can help to understand the error better?
Backtrace
{"$message_type":"artifact","artifact":"/home/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0/testimage-sdk/hello/target/debug/build/hello-69a92b98b70371ba/build_script_build-69a92b98b70371ba.d","emit":"dep-info"}
thread 'rustc' panicked at compiler/rustc_metadata/src/creader.rs:193:31:
index out of bounds: the len is 20 but the index is 60747757
stack backtrace:
0: 0x7fa9a2bcf31f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdd8826f6b9d3bb6e
1: 0x7fa9a2c0246b - core::fmt::write::hce77028645369722
2: 0x7fa9a2bca2ce - <unknown>
3: 0x7fa9a2bcf0ee - <unknown>
4: 0x7fa9a2bb889a - <unknown>
5: 0x7fa9a2bb8594 - std::panicking::default_hook::h49af0c7febe67f8d
6: 0x7fa9a37e7187 - <unknown>
7: 0x7fa9a2bb90e9 - std::panicking::rust_panic_with_hook::h14a0ca211eb21fbf
8: 0x7fa9a2bcf6e2 - <unknown>
9: 0x7fa9a2bcf529 - <unknown>
10: 0x7fa9a2bb8cc6 - rust_begin_unwind
11: 0x7fa9a2b71422 - core::panicking::panic_fmt::hb4b7de66d883fcc4
12: 0x7fa9a2b715f6 - core::panicking::panic_bounds_check::h4eecb12f9bb341c4
13: 0x7fa9a83c8ffd - <rustc_metadata[acbd193db608c71e]::creader::CStore as rustc_session[2c1f89e6504c4cfe]::cstore::CrateStore>::stable_crate_id
14: 0x7fa9a89931e9 - <unknown>
15: 0x7fa9a89978ed - <rustc_middle[fd6644fcde453e4f]::query::on_disk_cache::OnDiskCache>::serialize
16: 0x7fa9a8891541 - <rustc_middle[fd6644fcde453e4f]::ty::context::TyCtxt>::serialize_query_result_cache
17: 0x7fa9a826b2ea - <unknown>
18: 0x7fa9a82640cc - <unknown>
19: 0x7fa9a826b5c0 - <unknown>
20: 0x7fa9a827c0f1 - <unknown>
21: 0x7fa9a822acd9 - rustc_incremental[7e9745f68514030c]::persist::save::save_dep_graph
22: 0x7fa9a37f6045 - <unknown>
23: 0x7fa9a37a30bd - <unknown>
24: 0x7fa9a37c7ba7 - <unknown>
25: 0x7fa9a37c968d - <unknown>
26: 0x7fa9a2bbc73b - <unknown>
27: 0x7fa9a29c9b62 - <unknown>
28: 0x7fa9a2a4463c - <unknown>
29: 0x0 - <unknown>
error: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.79.0 (129f3b996 2024-06-10) (built from a source tarball) running on x86_64-pokysdk-linux-gnu
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: rustc interrupted by SIGSEGV, printing backtrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Area: Incremental compilationCategory: the reverse of a compiler bug is generally UBCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Relevant to the compiler team, which will review and decide on the PR/issue.