gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

NR2: ICE in operator->, at rust/util/optional.h:2044 extern main()

Open matthiaskrgr opened this issue 1 year ago • 0 comments

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use -frust-name-resolution-2.0
fn main() {
    extern "Rust" {
        fn main();
    }
    unsafe {
        main();
    }
}

original:

fn main() {
    extern "Rust" {
     fn main();
    }
    unsafe { main(); }
}

Version information:

765121736dfe3f5b319bbe9837880deda326394e

Possibly related line of code: https://github.com/Rust-GCC/gccrs/blob/765121736dfe3f5b319bbe9837880deda326394e/gcc/rust/util/optional.h#L2038-L2050

Command: /home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use -frust-name-resolution-2.0

Program output

crab1: internal compiler error: in operator->, at rust/util/optional.h:2044
0xd0435e tl::optional<Rust::Resolver::CanonicalPath const&>::operator->()
	../../gcc/rust/util/optional.h:2044
0xd0435e Rust::Compile::CompileExternItem::visit(Rust::HIR::ExternalFunctionItem&)
	../../gcc/rust/backend/rust-compile-extern.h:140
0xd011dd Rust::Compile::CompileExternItem::compile(Rust::HIR::ExternalItem*, Rust::Compile::Context*, Rust::TyTy::BaseType*, bool, unsigned int)
	../../gcc/rust/backend/rust-compile-extern.h:41
0xd011dd Rust::Compile::HIRCompileBase::query_compile(unsigned int, Rust::TyTy::BaseType*, Rust::HIR::PathIdentSegment const&, Rust::Analysis::NodeMapping const&, unsigned int, bool)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:264
0xd01abf Rust::Compile::ResolvePathRef::resolve_with_node_id(Rust::HIR::PathIdentSegment const&, Rust::Analysis::NodeMapping const&, unsigned int, bool, unsigned int)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:193
0xd01d11 Rust::Compile::ResolvePathRef::resolve(Rust::HIR::PathIdentSegment const&, Rust::Analysis::NodeMapping const&, unsigned int, bool)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:238
0xd02008 tree_node* Rust::Compile::ResolvePathRef::resolve_path_like<Rust::HIR::PathInExpression>(Rust::HIR::PathInExpression&)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:68
0xd02008 Rust::Compile::ResolvePathRef::Compile(Rust::HIR::PathInExpression&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:46
0x10702af ???
	../../gcc/rust/backend/rust-compile-expr.h:57
0x1076b6b Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:47
0x1076b6b Rust::Compile::CompileExpr::visit(Rust::HIR::CallExpr&)
	../../gcc/rust/backend/rust-compile-expr.cc:1319
0x1071b40 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:47
0x106c8e0 ???
	../../gcc/rust/backend/rust-compile-stmt.h:33
0x106cc8d Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-stmt.cc:36
0x108557b Rust::Compile::CompileBlock::visit(Rust::HIR::BlockExpr&)
	../../gcc/rust/backend/rust-compile-block.cc:53
0x1085b09 Rust::Compile::CompileBlock::compile(Rust::HIR::BlockExpr&, Rust::Compile::Context*, Bvariable*)
	../../gcc/rust/backend/rust-compile-block.cc:34
0x1078db5 ???
	../../gcc/rust/backend/rust-compile-expr.h:50
0x1071b40 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:47
0x109e742 Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
	../../gcc/rust/backend/rust-compile-base.cc:603
0x10a226c 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*)
	../../gcc/rust/backend/rust-compile-base.cc:773
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.

matthiaskrgr avatar Mar 30 '25 17:03 matthiaskrgr