gccrs
gccrs copied to clipboard
Tuple pattern as function parameter causes internal compiler error
I tried this code: https://godbolt.org/z/vTPqxfeMa
fn myfun((x, _): (i32, i32)) -> i32 {
x
}
I expected it to compile correctly and just throw warning function myfun is never used.
But instead it caused internal compiler error.
Trying out different irrefutable patterns as parameters, will comment if any other pattern causes error.
While investigating this bug, I tried out this: https://godbolt.org/z/3s398sW1r
The below code compiles correctly.
fn myfun() -> i32 {
let (x, a) = (1, 2);
x
}
This causes internal compiler error.
fn myfun() -> i32 {
let (x, _) = (1, 2);
x
}
ICE backtrace:
crab1: internal compiler error: in function_set_parameters, at rust/rust-gcc.cc:2284
0x236722c internal_error(char const*, ...)
???:0
0x9fc228 fancy_abort(char const*, int, char const*)
???:0
0xd8e28d Rust::Compile::HIRCompileBase::compile_function(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Rust::HIR::SelfParam&, std::vector<Rust::HIR::FunctionParam, std::allocator<Rust::HIR::FunctionParam> >&, Rust::HIR::FunctionQualifiers const&, Rust::HIR::Visibility&, std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >&, unsigned int, Rust::HIR::BlockExpr*, Rust::Resolver::CanonicalPath const*, Rust::TyTy::FnType*)
???:0
0xd64d3a Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
???:0
0xb3c829 Rust::Compile::CompileCrate::go()
???:0
0xb3c8a8 Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
???:0
0xb37b7c Rust::Session::compile_crate(char const*)
???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1