Rust-GCC / Rust-GCC/gccrs

NR2: ICE in finalize_rebind_import, at rust/resolve/rust-early-name-resolver-2.0.cc:434

Open
#3,634 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use -frust-name-resolution-2.0
mod exported {

    #[macro_export]
    macro_rules! legacy_macro {
        () => {};
    }

    pub use legacy_macro as _; // OK
}

original:

#![crate_name = "foo"]

mod exported {
    // Exported legacy macros are treated as `pub`.
    #[macro_export]
    macro_rules! legacy_macro { () => () }

    pub use legacy_macro as _; // OK
}
pub use self::private::Enum::*;

// @!has-dir foo/private
// @!has foo/index.html '//a/@href' 'private/index.html'

Version information:

765121736dfe3f5b319bbe9837880deda326394e

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/765121736dfe3f5b319bbe9837880deda326394e/gcc/rust/resolve/rust-early-name-resolver-2.0.cc#L428-L440

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 finalize_rebind_import, at rust/resolve/rust-early-name-resolver-2.0.cc:434
0x86780f Rust::Resolver2_0::Early::finalize_rebind_import(Rust::Resolver2_0::Early::ImportPair const&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:434
0xe24c10 Rust::Resolver2_0::Early::visit(Rust::AST::UseDeclaration&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:464
0xc1e0ff void Rust::AST::DefaultASTVisitor::visit<Rust::AST::Item>(std::unique_ptr<Rust::AST::Item, std::default_delete<Rust::AST::Item> >&)
	../../gcc/rust/ast/rust-ast-visitor.h:406
0xc1e0ff Rust::AST::DefaultASTVisitor::visit(Rust::AST::Module&)
	../../gcc/rust/ast/rust-ast-visitor.cc:785
0xe0d5d3 std::function<void ()>::operator()() const
	/usr/include/c++/14.2.1/bits/std_function.h:591
0xe0d5d3 Rust::Resolver2_0::NameResolutionContext::scoped(Rust::Resolver2_0::Rib::Kind, unsigned int, std::function<void ()>, tl::optional<Rust::Identifier>)
	../../gcc/rust/resolve/rust-name-resolution-context.cc:122
0xe11bb0 Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Module&)
	../../gcc/rust/resolve/rust-default-resolver.cc:43
0xe20e73 Rust::Resolver2_0::Early::visit(Rust::AST::Module&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:240
0xe211cf Rust::Resolver2_0::Early::go(Rust::AST::Crate&)
	../../gcc/rust/resolve/rust-early-name-resolver-2.0.cc:66
0xc45907 Rust::Session::expansion(Rust::AST::Crate&, Rust::Resolver2_0::NameResolutionContext&)
	../../gcc/rust/rust-session-manager.cc:949
0xc5bcd1 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:619
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ICE with the reduced Rust source and the command provided. Inspect rust/resolve/rust-early-name-resolver-2.0.cc around finalize_rebind_import at line 434, along with the UseDeclaration visitor; done means this input no longer reports an internal compiler error and handles the pub use correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.