Skip to content

Rust compiler error while building rust with coverage support. #104189

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

Closed
gvozdila opened this issue Nov 9, 2022 · 1 comment
Closed

Rust compiler error while building rust with coverage support. #104189

gvozdila opened this issue Nov 9, 2022 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@gvozdila
Copy link

gvozdila commented Nov 9, 2022

I tried to build current version of rust with coverage support.
Only different with current bc2504a version is #profiler = false --> profiler = True
build command is: RUST_BACKTRACE=1 ./x.py build
Out was:

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

rustc --version --verbose:
rustc 1.64.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.64.0
LLVM version: 14.0.6

$env

TIME_LIMIT=5000
TZ=Europe/Moscow
HOSTNAME=26f98d0db700
OLDPWD=/home/user
CFLAGS=-fprofile-instr-generate -fcoverage-mapping
AFL_MAP_SIZE=300000
CC=clang
CXXFLAGS=-fprofile-instr-generate -fcoverage-mapping
PWD=/home/user/rust
HOME=/home/user
CXX=clang++
COMMON_FLAGS=-gline-tables-only -O2 -fno-omit-frame-pointer
TERM=xterm
SHLVL=1
LDFLAGS=-fprofile-instr-generate
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
timeout=60
export=LIB_FUZZING_ENGINE=-fsanitize=fuzzer
LD=afl-clang-lto
RUSTFLAGS=-Cdebuginfo=1 -Cforce-frame-pointers -Clink-dead-code -Ccodegen-units=1 -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-stack-depth
_=/usr/bin/env
Backtrace

extracting /home/user/rust/build/cache/2022-09-20/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz
extracting /home/user/rust/build/cache/2022-09-20/rustc-beta-x86_64-unknown-linux-gnu.tar.xz
extracting /home/user/rust/build/cache/2022-09-20/cargo-beta-x86_64-unknown-linux-gnu.tar.xz
Building rustbuild
   Compiling memchr v2.5.0
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.46
   Compiling typenum v1.15.0
   Compiling version_check v0.9.4
   Compiling libc v0.2.126
   Compiling unicode-ident v1.0.0
   Compiling syn v1.0.102
   Compiling lazy_static v1.4.0
   Compiling cc v1.0.73
   Compiling serde_derive v1.0.137
   Compiling serde v1.0.137
   Compiling generic-array v0.14.5
   Compiling pkg-config v0.3.25
   Compiling regex-automata v0.1.10
   Compiling log v0.4.17
   Compiling quote v1.0.18
   Compiling io-lifetimes v0.7.2
   Compiling bstr v0.2.17
   Compiling aho-corasick v0.7.18
   Compiling crossbeam-utils v0.8.8
   Compiling regex-syntax v0.6.26
   Compiling rustix v0.35.6
   Compiling lzma-sys v0.1.17
   Compiling same-file v1.0.6
   Compiling serde_json v1.0.81
   Compiling linux-raw-sys v0.0.46
   Compiling fnv v1.0.7
   Compiling once_cell v1.12.0
   Compiling block-buffer v0.10.2
   Compiling crypto-common v0.1.3
   Compiling bitflags v1.3.2
   Compiling digest v0.10.3
   Compiling thread_local v1.1.4
   Compiling walkdir v2.3.2
   Compiling xattr v0.2.3
   Compiling filetime v0.2.16
   Compiling itoa v1.0.2
   Compiling ryu v1.0.10
   Compiling cpufeatures v0.2.2
   Compiling unicode-width v0.1.9
   Compiling bootstrap v0.0.0 (/home/user/rust/src/bootstrap)
   Compiling getopts v0.2.21
   Compiling sha2 v0.10.2
   Compiling tar v0.4.38
   Compiling xz2 v0.1.6
   Compiling regex v1.5.6
   Compiling opener v0.5.0
   Compiling cmake v0.1.48
   Compiling hex v0.4.3
   Compiling fd-lock v3.0.6
   Compiling globset v0.4.8
   Compiling ignore v0.4.18
   Compiling toml v0.5.9
    Finished dev [unoptimized] target(s) in 36.96s
extracting /home/user/rust/build/cache/2022-09-20/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz to /home/user/rust/build/x86_64-unknown-linux-gnu/stage0
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling cc v1.0.73
   Compiling core v0.0.0 (/home/user/rust/library/core)
   Compiling libc v0.2.135
   Compiling memchr v2.5.0
   Compiling std v0.0.0 (/home/user/rust/library/std)
   Compiling compiler_builtins v0.1.82
   Compiling unwind v0.0.0 (/home/user/rust/library/unwind)
   Compiling profiler_builtins v0.0.0 (/home/user/rust/library/profiler_builtins)
   Compiling rustc-std-workspace-core v1.99.0 (/home/user/rust/library/rustc-std-workspace-core)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_monomorphize/src/collector.rs:1379:36
stack backtrace:
   0:     0x7ff40851cc90 - std::backtrace_rs::backtrace::libunwind::trace::he4b135b282ad0bdb
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7ff40851cc90 - std::backtrace_rs::backtrace::trace_unsynchronized::h95dd1a9f59a261f0
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff40851cc90 - std::sys_common::backtrace::_print_fmt::hb2d5f7f2edfb1871
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7ff40851cc90 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbbdb63e1a9e5bae0
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7ff4085779ee - core::fmt::write::hc0fd3d64c7964deb
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/core/src/fmt/mod.rs:1202:17
   5:     0x7ff40850d7a5 - std::io::Write::write_fmt::h1519d1f8a9f30a76
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/io/mod.rs:1679:15
   6:     0x7ff40851f943 - std::sys_common::backtrace::_print::h024f4799bdf90945
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7ff40851f943 - std::sys_common::backtrace::print::h7afbde668e15046e
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7ff40851f943 - std::panicking::default_hook::{{closure}}::hd91c46b08dd5ed53
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/panicking.rs:295:22
   9:     0x7ff40851f62f - std::panicking::default_hook::hd24a3e5b374ef38d
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/panicking.rs:314:9
  10:     0x7ff40ad349b1 - <rustc_driver[9c43a358105c7dbe]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[74a8d7cf5c6329dd]::ops::function::FnOnce<(&core[74a8d7cf5c6329dd]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7ff40852017d - std::panicking::rust_panic_with_hook::h227f8f44fe4dcc4d
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/panicking.rs:702:17
  12:     0x7ff40851ff91 - std::panicking::begin_panic_handler::{{closure}}::h643d0c4e5ea667c5
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/panicking.rs:586:13
  13:     0x7ff40851d13c - std::sys_common::backtrace::__rust_end_short_backtrace::hfc98d21e90a8d7a6
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7ff40851fcf2 - rust_begin_unwind
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/panicking.rs:584:5
  15:     0x7ff4085745c3 - core::panicking::panic_fmt::h7c86307091386a9a
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/core/src/panicking.rs:142:14
  16:     0x7ff40857440d - core::panicking::panic::h23b207df3263cf9f
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/core/src/panicking.rs:48:5
  17:     0x7ff40a5143d5 - rustc_monomorphize[b0164599a55885ba]::collector::collect_roots
  18:     0x7ff40a50a2b9 - <rustc_session[841b3c5cdfa4a6e9]::session::Session>::time::<alloc[d860db1085ca5803]::vec::Vec<rustc_middle[42f7879d112b1aa3]::mir::mono::MonoItem>, rustc_monomorphize[b0164599a55885ba]::collector::collect_crate_mono_items::{closure#0}>
  19:     0x7ff40a50a081 - rustc_monomorphize[b0164599a55885ba]::collector::collect_crate_mono_items
  20:     0x7ff40a509076 - rustc_monomorphize[b0164599a55885ba]::partitioning::collect_and_partition_mono_items
  21:     0x7ff40aaf21ad - rustc_query_system[9ae1097dd5b38c5b]::query::plumbing::try_execute_query::<rustc_query_impl[eee503ccf3b24082]::plumbing::QueryCtxt, rustc_query_system[9ae1097dd5b38c5b]::query::caches::DefaultCache<(), (&std[fa71d80230c9c056]::collections::hash::set::HashSet<rustc_span[f8046a25c6672ded]::def_id::DefId, core[74a8d7cf5c6329dd]::hash::BuildHasherDefault<rustc_hash[c3d968b183957621]::FxHasher>>, &[rustc_middle[42f7879d112b1aa3]::mir::mono::CodegenUnit])>>
  22:     0x7ff40aaf1e8b - rustc_query_system[9ae1097dd5b38c5b]::query::plumbing::get_query::<rustc_query_impl[eee503ccf3b24082]::queries::collect_and_partition_mono_items, rustc_query_impl[eee503ccf3b24082]::plumbing::QueryCtxt>
  23:     0x7ff40aaf1dce - <rustc_query_impl[eee503ccf3b24082]::Queries as rustc_middle[42f7879d112b1aa3]::ty::query::QueryEngine>::collect_and_partition_mono_items
  24:     0x7ff40a83eb52 - rustc_codegen_ssa[5053ebe5a49dcf02]::base::codegen_crate::<rustc_codegen_llvm[342a5f2ef0dfd38c]::LlvmCodegenBackend>
  25:     0x7ff40a83e922 - <rustc_codegen_llvm[342a5f2ef0dfd38c]::LlvmCodegenBackend as rustc_codegen_ssa[5053ebe5a49dcf02]::traits::backend::CodegenBackend>::codegen_crate
  26:     0x7ff409b510bc - <rustc_session[841b3c5cdfa4a6e9]::session::Session>::time::<alloc[d860db1085ca5803]::boxed::Box<dyn core[74a8d7cf5c6329dd]::any::Any>, rustc_interface[279f75d423814323]::passes::start_codegen::{closure#0}>
  27:     0x7ff409b50a8e - <rustc_interface[279f75d423814323]::passes::QueryContext>::enter::<<rustc_interface[279f75d423814323]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[74a8d7cf5c6329dd]::result::Result<alloc[d860db1085ca5803]::boxed::Box<dyn core[74a8d7cf5c6329dd]::any::Any>, rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>>
  28:     0x7ff409b109a3 - <rustc_interface[279f75d423814323]::queries::Queries>::ongoing_codegen
  29:     0x7ff409b0edfa - rustc_interface[279f75d423814323]::interface::create_compiler_and_run::<core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>, rustc_driver[9c43a358105c7dbe]::run_compiler::{closure#1}>
  30:     0x7ff409b0d6f2 - <scoped_tls[88a6cd5de53874af]::ScopedKey<rustc_span[f8046a25c6672ded]::SessionGlobals>>::set::<rustc_interface[279f75d423814323]::interface::run_compiler<core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>, rustc_driver[9c43a358105c7dbe]::run_compiler::{closure#1}>::{closure#0}, core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>>
  31:     0x7ff409b0d3df - std[fa71d80230c9c056]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[279f75d423814323]::util::run_in_thread_pool_with_globals<rustc_interface[279f75d423814323]::interface::run_compiler<core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>, rustc_driver[9c43a358105c7dbe]::run_compiler::{closure#1}>::{closure#0}, core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>>::{closure#0}, core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>>
  32:     0x7ff40aba9230 - <<std[fa71d80230c9c056]::thread::Builder>::spawn_unchecked_<rustc_interface[279f75d423814323]::util::run_in_thread_pool_with_globals<rustc_interface[279f75d423814323]::interface::run_compiler<core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>, rustc_driver[9c43a358105c7dbe]::run_compiler::{closure#1}>::{closure#0}, core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>>::{closure#0}, core[74a8d7cf5c6329dd]::result::Result<(), rustc_errors[c8662fcb21d66c60]::ErrorGuaranteed>>::{closure#1} as core[74a8d7cf5c6329dd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  33:     0x7ff408529f53 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hddea892768967669
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/alloc/src/boxed.rs:1940:9
  34:     0x7ff408529f53 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h908c7909b9c5388e
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/alloc/src/boxed.rs:1940:9
  35:     0x7ff408529f53 - std::sys::unix::thread::Thread::new::thread_start::h5f564412beba7a54
                               at /rustc/2a65764f21cf10b7e03c645f1ad0946e42758e0a/library/std/src/sys/unix/thread.rs:108:17
  36:     0x7ff40829a48a - <unknown>
  37:     0x7ff40831de20 - __clone
  38:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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.65.0-beta.1 (2a65764f2 2022-09-19) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 -Z unstable-options -C debuginfo=1 -C force-frame-pointers -C link-dead-code -C codegen-units=1 -C llvm-args=-sanitizer-coverage-level=4 -C llvm-args=-sanitizer-coverage-trace-compares -C llvm-args=-sanitizer-coverage-inline-8bit-counters -C llvm-args=-sanitizer-coverage-pc-table -C llvm-args=-sanitizer-coverage-stack-depth -C symbol-mangling-version=legacy -Z unstable-options -Z unstable-options -Z macro-backtrace -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -C split-debuginfo=off -C prefer-dynamic -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -Z binary-dep-depinfo -Z force-unstable-if-unmarked

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `core`
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:01:04


@gvozdila gvozdila added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 9, 2022
@tmiasko
Copy link
Contributor

tmiasko commented Nov 9, 2022

This was fixed in #103950. You can avoid the problem by omitting the -Clink-dead-code flag.

@tmiasko tmiasko closed this as completed Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants