Skip to content
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

ICE when compiling read_fonts crate with -Zsanitizer=cfi #128484

Closed
1c3t3a opened this issue Aug 1, 2024 · 3 comments
Closed

ICE when compiling read_fonts crate with -Zsanitizer=cfi #128484

1c3t3a opened this issue Aug 1, 2024 · 3 comments
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

@1c3t3a
Copy link
Contributor

1c3t3a commented Aug 1, 2024

Code

Compiling the read_fonts crate (code) with RUSTFLAGS="-Clinker-plugin-lto -Zsanitizer=cfi" yields this error. I will try to lower down the code to a minimal reproducible example next week.

Meta

rustc --version --verbose:

rustc 1.82.0-nightly (28a58f2fa 2024-07-31)
binary: rustc
commit-hash: 28a58f2fa7f0c46b8fab8237c02471a915924fe5
commit-date: 2024-07-31
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

Error output

<output>
Backtrace

RUST_BACKTRACE=full RUSTFLAGS="-Clinker-plugin-lto -Zsanitizer=cfi" cargo b -Zbuild-std -Zbuild-std-features --release --target x86_64-unknown-linux-gnu
   Compiling read-fonts v0.19.3
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:169:90: Failed to normalize std::option::Option<(Alias(Projection, AliasTy { args: [std::iter::Chain<std::iter::Flatten<std::option::IntoIter<std::iter::Map<std::slice::Iter<'{erased}, types::BigEndian<types::GlyphId>>, Closure(DefId(0:1241 ~ read_fonts[4d05]::tables::layout::{impl#6}::iter::{closure#0}), ['{erased}, i16, Binder { value: extern "RustCall" fn((&'{erased} types::BigEndian<types::GlyphId>,)) -> types::GlyphId, bound_vars: [] }, ()])>>>, std::iter::Flatten<std::option::IntoIter<std::iter::FlatMap<std::slice::Iter<'{erased}, tables::layout::RangeRecord>, std::iter::Map<std::ops::RangeInclusive<u16>, FnDef(DefId(13:68 ~ font_types[0196]::glyph_id::{impl#0}::new), [])>, FnDef(DefId(0:1251 ~ read_fonts[4d05]::tables::layout::{impl#9}::iter), [])>>>>], def_id: DefId(2:8499 ~ core[d45d]::iter::traits::iterator::Iterator::Item), .. }), Alias(Projection, AliasTy { args: [std::iter::FromFn<Closure(DefId(0:228 ~ read_fonts[4d05]::offset_array::{impl#3}::iter::{closure#0}), ['{erased}, table_ref::TableRef<'{erased}, tables::layout::SequenceRuleSetMarker>, types::Offset16, i16, Binder { value: extern "RustCall" fn(()) -> std::option::Option<std::option::Option<std::result::Result<table_ref::TableRef<'{erased}, tables::layout::SequenceRuleSetMarker>, read::ReadError>>>, bound_vars: [] }, (std::slice::Iter<'{erased}, types::BigEndian<types::Nullable<types::Offset16>>>, font_data::FontData<'{erased}>, ())])>], def_id: DefId(2:8499 ~ core[d45d]::iter::traits::iterator::Iterator::Item), .. }))>, maybe try to call `try_normalize_erasing_regions` instead

thread 'rustc' panicked at compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:169:90:
Box<dyn Any>
stack backtrace:
   0:     0x7ff86949754d - std::backtrace_rs::backtrace::libunwind::trace::h32241ecce7cc97b4
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7ff86949754d - std::backtrace_rs::backtrace::trace_unsynchronized::he88bad54ee1027a8
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff86949754d - std::sys::backtrace::_print_fmt::h1a79c79abdff1de3
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/sys/backtrace.rs:66:9
   3:     0x7ff86949754d - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h4ba39a43d3e87adf
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/sys/backtrace.rs:39:26
   4:     0x7ff8694e803b - core::fmt::rt::Argument::fmt::h6ad1535845790bc6
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/core/src/fmt/rt.rs:173:76
   5:     0x7ff8694e803b - core::fmt::write::h948fa78229aa764e
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/core/src/fmt/mod.rs:1178:21
   6:     0x7ff86948ba93 - std::io::Write::write_fmt::h60b4ed4b4cde96a3
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/io/mod.rs:1823:15
   7:     0x7ff869499d42 - std::sys::backtrace::BacktraceLock::print::h5d733821ad3e76e5
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/sys/backtrace.rs:42:9
   8:     0x7ff869499d42 - std::panicking::default_hook::{{closure}}::h326e80fe334527f5
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/panicking.rs:266:22
   9:     0x7ff8694999ae - std::panicking::default_hook::h154dcec67b5cc2b3
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/panicking.rs:293:9
  10:     0x7ff865abeef7 - std[6735b9bece8a6c64]::panicking::update_hook::<alloc[950cb356210e115c]::boxed::Box<rustc_driver_impl[5e3d74da74d89118]::install_ice_hook::{closure#0}>>::{closure#0}
  11:     0x7ff86949a732 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h46ade2009b590b71
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/alloc/src/boxed.rs:2162:9
  12:     0x7ff86949a732 - std::panicking::rust_panic_with_hook::haa0d1f76c5d6487e
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/panicking.rs:805:13
  13:     0x7ff865af95e1 - std[6735b9bece8a6c64]::panicking::begin_panic::<rustc_errors[7a55141d834a6923]::ExplicitBug>::{closure#0}
  14:     0x7ff865aec486 - std[6735b9bece8a6c64]::sys::backtrace::__rust_end_short_backtrace::<std[6735b9bece8a6c64]::panicking::begin_panic<rustc_errors[7a55141d834a6923]::ExplicitBug>::{closure#0}, !>
  15:     0x7ff865aec436 - std[6735b9bece8a6c64]::panicking::begin_panic::<rustc_errors[7a55141d834a6923]::ExplicitBug>
  16:     0x7ff865b02d01 - <rustc_errors[7a55141d834a6923]::diagnostic::BugAbort as rustc_errors[7a55141d834a6923]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  17:     0x7ff8660d9074 - rustc_middle[7c03d9d3aaa26afb]::util::bug::opt_span_bug_fmt::<rustc_span[c29b4e18ee0a3f38]::span_encoding::Span>::{closure#0}
  18:     0x7ff8660be10a - rustc_middle[7c03d9d3aaa26afb]::ty::context::tls::with_opt::<rustc_middle[7c03d9d3aaa26afb]::util::bug::opt_span_bug_fmt<rustc_span[c29b4e18ee0a3f38]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  19:     0x7ff8660bdf8b - rustc_middle[7c03d9d3aaa26afb]::ty::context::tls::with_context_opt::<rustc_middle[7c03d9d3aaa26afb]::ty::context::tls::with_opt<rustc_middle[7c03d9d3aaa26afb]::util::bug::opt_span_bug_fmt<rustc_span[c29b4e18ee0a3f38]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  20:     0x7ff863e8ce10 - rustc_middle[7c03d9d3aaa26afb]::util::bug::bug_fmt
  21:     0x7ff86758e246 - <rustc_middle[7c03d9d3aaa26afb]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[d459e222c9f6e896]::fold::TypeFolder<rustc_middle[7c03d9d3aaa26afb]::ty::context::TyCtxt>>::fold_ty
  22:     0x7ff86758d818 - <rustc_type_ir[d459e222c9f6e896]::ty_kind::FnSig<rustc_middle[7c03d9d3aaa26afb]::ty::context::TyCtxt> as rustc_type_ir[d459e222c9f6e896]::fold::TypeFoldable<rustc_middle[7c03d9d3aaa26afb]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[7c03d9d3aaa26afb]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
  23:     0x7ff8677c1ba2 - rustc_ty_utils[cb5e61cfc0450708]::abi::fn_abi_new_uncached
  24:     0x7ff8677bb121 - rustc_ty_utils[cb5e61cfc0450708]::abi::fn_abi_of_instance
  25:     0x7ff8677b9b79 - rustc_query_impl[bf72133feb0f109a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bf72133feb0f109a]::query_impl::fn_abi_of_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c03d9d3aaa26afb]::query::erase::Erased<[u8; 16usize]>>
  26:     0x7ff8677b7b40 - rustc_query_system[c0479f94767de6d]::query::plumbing::try_execute_query::<rustc_query_impl[bf72133feb0f109a]::DynamicConfig<rustc_query_system[c0479f94767de6d]::query::caches::DefaultCache<rustc_middle[7c03d9d3aaa26afb]::ty::ParamEnvAnd<(rustc_middle[7c03d9d3aaa26afb]::ty::instance::Instance, &rustc_middle[7c03d9d3aaa26afb]::ty::list::RawList<(), rustc_middle[7c03d9d3aaa26afb]::ty::Ty>)>, rustc_middle[7c03d9d3aaa26afb]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bf72133feb0f109a]::plumbing::QueryCtxt, false>
  27:     0x7ff8677b778c - rustc_query_impl[bf72133feb0f109a]::query_impl::fn_abi_of_instance::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7ff86659d3a6 - rustc_sanitizers[41cc9708b15e165d]::cfi::typeid::itanium_cxx_abi::typeid_for_instance
  29:     0x7ff8642fa5a4 - <rustc_codegen_llvm[6693dbe16cf67684]::context::CodegenCx as rustc_codegen_ssa[5ffe24d12073cde6]::traits::declare::PreDefineMethods>::predefine_fn
  30:     0x7ff867e9fda1 - rustc_codegen_llvm[6693dbe16cf67684]::base::compile_codegen_unit::module_codegen
  31:     0x7ff867e9d082 - <rustc_codegen_llvm[6693dbe16cf67684]::LlvmCodegenBackend as rustc_codegen_ssa[5ffe24d12073cde6]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  32:     0x7ff868083b66 - <rustc_codegen_llvm[6693dbe16cf67684]::LlvmCodegenBackend as rustc_codegen_ssa[5ffe24d12073cde6]::traits::backend::CodegenBackend>::codegen_crate
  33:     0x7ff8680b4158 - <rustc_interface[1300cdbf8ee6dff9]::queries::Linker>::codegen_and_build_linker
  34:     0x7ff867ed7d3b - rustc_interface[1300cdbf8ee6dff9]::interface::run_compiler::<core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>, rustc_driver_impl[5e3d74da74d89118]::run_compiler::{closure#0}>::{closure#1}
  35:     0x7ff867e0c809 - std[6735b9bece8a6c64]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1300cdbf8ee6dff9]::util::run_in_thread_with_globals<rustc_interface[1300cdbf8ee6dff9]::util::run_in_thread_pool_with_globals<rustc_interface[1300cdbf8ee6dff9]::interface::run_compiler<core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>, rustc_driver_impl[5e3d74da74d89118]::run_compiler::{closure#0}>::{closure#1}, core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>>::{closure#0}, core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>>
  36:     0x7ff867e0c5b2 - <<std[6735b9bece8a6c64]::thread::Builder>::spawn_unchecked_<rustc_interface[1300cdbf8ee6dff9]::util::run_in_thread_with_globals<rustc_interface[1300cdbf8ee6dff9]::util::run_in_thread_pool_with_globals<rustc_interface[1300cdbf8ee6dff9]::interface::run_compiler<core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>, rustc_driver_impl[5e3d74da74d89118]::run_compiler::{closure#0}>::{closure#1}, core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>>::{closure#0}, core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[53251afa801eb14e]::result::Result<(), rustc_span[c29b4e18ee0a3f38]::ErrorGuaranteed>>::{closure#1} as core[53251afa801eb14e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7ff8694a455b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7501bf06aeb0baa1
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/alloc/src/boxed.rs:2148:9
  38:     0x7ff8694a455b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h822e7161a8507b21
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/alloc/src/boxed.rs:2148:9
  39:     0x7ff8694a455b - std::sys::pal::unix::thread::Thread::new::thread_start::hd2564588fac3af04
                               at /rustc/28a58f2fa7f0c46b8fab8237c02471a915924fe5/library/std/src/sys/pal/unix/thread.rs:105:17
  40:     0x7ff8624a539c - start_thread
                               at ./nptl/pthread_create.c:444:8
  41:     0x7ff862526608 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
  42:                0x0 - <unknown>

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/usr/local/google/home/bkersting/.cargo/registry/src/index.crates.io-6f17d22bba15001f/read-fonts-0.19.3/rustc-ice-2024-08-01T09_45_29-517103.txt` to your bug report

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo -Z unstable-options -C linker-plugin-lto -Z sanitizer=cfi

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

query stack during panic:
#0 [fn_abi_of_instance] computing call ABI of `<core::iter::adapters::zip::Zip<core::iter::adapters::chain::Chain<core::iter::adapters::flatten::Flatten<core::option::IntoIter<core::iter::adapters::map::Map<core::slice::iter::Iter<'_, font_types::raw::BigEndian<font_types::glyph_id::GlyphId>>, {closure@/usr/local/google/home/bkersting/.cargo/registry/src/index.crates.io-6f17d22bba15001f/read-fonts-0.19.3/src/tables/layout.rs:151:75: 151:78}>>>, core::iter::adapters::flatten::Flatten<core::option::IntoIter<core::iter::adapters::flatten::FlatMap<core::slice::iter::Iter<'_, tables::layout::RangeRecord>, core::iter::adapters::map::Map<core::ops::range::RangeInclusive<u16>, font_types::glyph_id::GlyphId::new>, tables::layout::<impl at /usr/local/google/home/bkersting/.cargo/registry/src/index.crates.io-6f17d22bba15001f/read-fonts-0.19.3/src/tables/layout.rs:205:1: 205:17>::iter>>>>, core::iter::sources::from_fn::FromFn<{closure@/usr/local/google/home/bkersting/.cargo/registry/src/index.crates.io-6f17d22bba15001f/read-fonts-0.19.3/src/offset_array.rs:143:28: 143:35}>> as core::iter::traits::iterator::Iterator>::next`
end of query stack
error: could not compile `read-fonts` (lib)

@1c3t3a 1c3t3a 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 Aug 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 1, 2024
@matthiaskrgr
Copy link
Member

this is probably a duplicate of #114160

@1c3t3a
Copy link
Contributor Author

1c3t3a commented Aug 1, 2024

Thanks @matthiaskrgr, it very much looks like it!

@rcvalle
Copy link
Member

rcvalle commented Aug 6, 2024

This was fixed in #128580.

@rcvalle rcvalle closed this as completed Aug 6, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 7, 2024
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

5 participants