Skip to content

fast inverse square root algorithm causes ICE #83594

Closed
@ghost

Description

Code

fn main() {
	let number: f64 = 2.0;

	let mut i: i64;
	let mut x2: f64;
	let mut y: f64;

	x2 = number * 0.5;
	y  = number;
	i  = unsafe { std::mem::transmute(y) };
	i  = 0x5f3759df - ( i >> 1 );
	y  = unsafe { std::mem::transmute(i) };
	y  = y * ( 1.5 - ( x2 * y * y ) );

	dbg!(y);
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-pc-windows-msvc
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

   Compiling untitled v0.1.0 (C:\Users\!\PycharmProjects\untitled)
warning: variable does not need to be mutable
 --> src\main.rs:5:6
  |
5 |     let mut x2: f64;
  |         ----^^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

thread 'rustc' panicked at 'found unstable fingerprints for predicates_of(core[f48f]::ops::function::Fn): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::ops::FnMut<Args>>)), C:\Users\!\.r
ustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ops\function.rs:67:21: 67:32 (#0)), (Binder(TraitPredicate(<Args as std::marker::Sized>)), C:\Users\!\.rustup\toolchains\nightly-x86_64-pc
-windows-msvc\lib/rustlib/src/rust\library\core\src\ops\function.rs:67:14: 67:18 (#0)), (Binder(TraitPredicate(<Self as std::ops::Fn<Args>>)), C:\Users\!\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust
\library\core\src\ops\function.rs:67:1: 67:32 (#0))] }', /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597\compiler\rustc_query_system\src\query\plumbing.rs:593:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.53.0-nightly (07e0e2ec2 2021-03-24) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [predicates_of] computing predicates of `std::ops::Fn`
#1 [vtable_methods] finding all methods for trait std::ops::Fn
end of query stack
warning: 1 warning emitted

error: could not compile `untitled`

To learn more, run the command again with --verbose.

Backtrace

   0:     0x7ff9bfe677ee - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h62553bb33d269d2e
   1:     0x7ff9bfe927cc - core::fmt::write::h187a24ff0c56237d
   2:     0x7ff9bfe5b208 - <std::io::IoSlice as core::fmt::Debug>::fmt::h7a51133a1941366b
   3:     0x7ff9bfe6ba02 - std::panicking::take_hook::ha7af702674468c4c
   4:     0x7ff9bfe6b4da - std::panicking::take_hook::ha7af702674468c4c
   5:     0x7ff99378b057 - rustc_driver::report_ice::h530a14ca8f015ece
   6:     0x7ff9bfe6c1e5 - std::panicking::rust_panic_with_hook::hffdabf0e02906eb3
   7:     0x7ff9bfe6bdc1 - rust_begin_unwind
   8:     0x7ff9bfe6810f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h62553bb33d269d2e
   9:     0x7ff9bfe6bd19 - rust_begin_unwind
  10:     0x7ff9bfec463c - std::panicking::begin_panic_fmt::h5f113f8f74763d19
  11:     0x7ff9962e579c - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  12:     0x7ff996304874 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  13:     0x7ff99653053b - <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::store_diagnostics_for_anon_node::hd7e2bd798bf2fb8b
  14:     0x7ff9961f5b60 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  15:     0x7ff99645960d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::hb6d9ba37c0f7d1ee
  16:     0x7ff9976af05c - rustc_middle::ty::generics::GenericPredicates::instantiate_identity::h7cccdff9f99c935d
  17:     0x7ff9976aee87 - rustc_middle::ty::generics::GenericPredicates::instantiate_identity::h7cccdff9f99c935d
  18:     0x7ff9972f370c - rustc_trait_selection::traits::object_safety::trait_has_sized_self::h0797b4b5e991aeda
  19:     0x7ff99730bfa2 - <rustc_trait_selection::autoderef::AutoderefKind as core::fmt::Debug>::fmt::hd7d2cb8797a6c1a8
  20:     0x7ff99732f2d6 - <rustc_trait_selection::traits::select::ProvisionalEvaluation as core::fmt::Debug>::fmt::h913e1987ab901c59
  21:     0x7ff997339f7f - <rustc_trait_selection::traits::select::ProvisionalEvaluation as core::fmt::Debug>::fmt::h913e1987ab901c59
  22:     0x7ff997a4fc82 - serde::private::de::content::Content::unexpected::h6d87dd8f51c125db
  23:     0x7ff99735c973 - <rustc_trait_selection::traits::util::TraitAliasExpansionInfo as core::fmt::Debug>::fmt::hb15f687dc7699e18
  24:     0x7ff99731916c - rustc_trait_selection::traits::impossible_predicates::h2cd0abc6599d53f8
  25:     0x7ff9963236c7 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  26:     0x7ff99651dc79 - <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::store_diagnostics_for_anon_node::hd7e2bd798bf2fb8b
  27:     0x7ff99630fa63 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  28:     0x7ff996541963 - <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::store_diagnostics_for_anon_node::hd7e2bd798bf2fb8b
  29:     0x7ff9961ee4be - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  30:     0x7ff99645f7fe - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::hb6d9ba37c0f7d1ee
  31:     0x7ff996841d89 - <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_rvalue::h80f0431c091c2e6f
  32:     0x7ff99684617b - <rustc_mir::monomorphize::collector::RootCollector as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item::he5797b6198dd680f
  33:     0x7ff99683edb1 - rustc_mir::monomorphize::collector::collect_crate_mono_items::h76a88f17d53533f9
  34:     0x7ff996b427ac - <rustc_mir::transform::rustc_peek::PeekCall as core::fmt::Debug>::fmt::h761d8600c314ecce
  35:     0x7ff99683d266 - rustc_mir::monomorphize::collector::collect_crate_mono_items::h76a88f17d53533f9
  36:     0x7ff996b23339 - rustc_mir::monomorphize::partitioning::partition::hefa27f3962f7cb81
  37:     0x7ff99632668a - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  38:     0x7ff9965194e1 - <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::store_diagnostics_for_anon_node::hd7e2bd798bf2fb8b
  39:     0x7ff9964b09b7 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::hb6d9ba37c0f7d1ee
  40:     0x7ff99653bbeb - <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::store_diagnostics_for_anon_node::hd7e2bd798bf2fb8b
  41:     0x7ff996296cdb - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  42:     0x7ff9962210cb - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h10fb49fa6f6cbb54
  43:     0x7ff996463ae8 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::hb6d9ba37c0f7d1ee
  44:     0x7ff9939f9b3a - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h8a4e9bbd19201980
  45:     0x7ff9938d2dd8 - rustc_interface::passes::BoxedResolver::to_resolver_outputs::h26a866d2af02ca21
  46:     0x7ff9938df0b6 - rustc_interface::queries::Queries::ongoing_codegen::h23da4f767055d06d
  47:     0x7ff9937a2c53 - <rustc_middle::ty::SymbolName as core::fmt::Debug>::fmt::h898edfdbf8c7dbdf
  48:     0x7ff9938016bc - <rustc_driver::args::Error as core::fmt::Debug>::fmt::h54d0345b5b43328e
  49:     0x7ff9937a51eb - <rustc_middle::ty::SymbolName as core::fmt::Debug>::fmt::h898edfdbf8c7dbdf
  50:     0x7ff993794034 - rustc_driver::pretty::print_after_hir_lowering::h04bf553be4aa75de
  51:     0x7ff9937a745f - <rustc_middle::ty::SymbolName as core::fmt::Debug>::fmt::h898edfdbf8c7dbdf
  52:     0x7ff9937c676d - <rustc_hir::intravisit::ErasedMap as rustc_hir::intravisit::Map>::foreign_item::he23d70bdee5d6fd3
  53:     0x7ff9bfe7b16a - std::sys::windows::thread::Thread::new::h485ded1a10d2ce17
  54:     0x7ff9f6d57034 - BaseThreadInitThunk
  55:     0x7ff9f7a42651 - RtlUserThreadStart

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions