gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

ICE when passing function pointers without return types as argument

Open CohenArthur opened this issue 3 years ago • 0 comments

I tried this code:

fn foo(a: fn(i32)) {}
fn bar(a: fn()) {}
fn baz(a: fn(i32) -> i32) {} // no issue

I expected to see this happen: No error!

Instead, this happened: ICE

rust1: internal compiler error: in check_base_type_privacy, at rust/privacy/rust-privacy-reporter.cc:158
0x1333bb5 Rust::Privacy::PrivacyReporter::check_base_type_privacy(Rust::Analysis::NodeMapping&, Rust::TyTy::BaseType const*, Location const&)
	../../gcc/rust/privacy/rust-privacy-reporter.cc:158
0x1333cbc Rust::Privacy::PrivacyReporter::check_type_privacy(Rust::HIR::Type const*, Location const&)
	../../gcc/rust/privacy/rust-privacy-reporter.cc:177
0x133512b Rust::Privacy::PrivacyReporter::visit(Rust::HIR::Function&)
	../../gcc/rust/privacy/rust-privacy-reporter.cc:613
0x121b929 Rust::HIR::Function::accept_vis(Rust::HIR::HIRStmtVisitor&)
	../../gcc/rust/hir/tree/rust-hir-full-test.cc:5147
0x13336be Rust::Privacy::PrivacyReporter::go(Rust::HIR::Crate&)
	../../gcc/rust/privacy/rust-privacy-reporter.cc:20
0x132df57 Rust::Privacy::Resolver::resolve(Rust::HIR::Crate&)
	../../gcc/rust/privacy/rust-privacy-check.cc:44
0x116525e Rust::Session::parse_file(char const*)
	../../gcc/rust/rust-session-manager.cc:751
0x1164893 Rust::Session::parse_files(int, char const**)
	../../gcc/rust/rust-session-manager.cc:572
0x102ee36 grs_langhook_parse_file
	../../gcc/rust/rust-lang.cc:175

Meta

  • What version of Rust GCC were you using, git sha if possible.

https://github.com/Rust-GCC/gccrs/commit/8cad07cfd2244ad9a40027a4306b81b4553a4797

CohenArthur avatar May 18 '22 14:05 CohenArthur