Skip to content

ICE in resolve_with_node_id, at rust/backend/rust-compile-resolve-path.cc GCEs #4302

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
pub struct Foo<const N: usize>;

pub fn foo<const N: usize>() -> Foo<{ N + 1 }> {
    Foo
}

original:

#![array_2(generic_const_exprs)]

pub struct Foo<const N: usize>;

pub fn foo<const N: usize>() -> Foo<{ N + 1 }> {
    Foo
}

Version information:

f942905

Possibly related line of code:

// possibly a const expr value
if (lookup->get_kind () == TyTy::TypeKind::CONST)
{
auto d = lookup->destructure ();
rust_assert (d->get_kind () == TyTy::TypeKind::CONST);
auto c = d->as_const_type ();
rust_assert (c->const_kind () == TyTy::BaseConstType::ConstKind::Value);
auto val = static_cast<TyTy::ConstValueType *> (c);
return val->get_value ();
}
// Handle unit struct
tree resolved_item = error_mark_node;

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

Program output

crab1: internal compiler error: in resolve_with_node_id, at rust/backend/rust-compile-resolve-path.cc:196
0x309a879 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:787
0xc38387 fancy_abort(char const*, int, char const*)
	../../gcc/diagnostics/context.cc:1805
0x90eade Rust::Compile::ResolvePathRef::resolve_with_node_id(Rust::HIR::PathIdentSegment const&, Rust::Analysis::NodeMapping const&, unsigned long, bool, unsigned int)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:196
0xec95f1 Rust::Compile::ResolvePathRef::resolve(Rust::HIR::PathIdentSegment const&, Rust::Analysis::NodeMapping const&, unsigned long, bool)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:243
0xec95f1 tree_node* Rust::Compile::ResolvePathRef::resolve_path_like<Rust::HIR::PathInExpression>(Rust::HIR::PathInExpression&)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:68
0xec95f1 Rust::Compile::ResolvePathRef::Compile(Rust::HIR::PathInExpression&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-resolve-path.cc:46
0x115c85f ???
	../../gcc/rust/backend/rust-compile-expr.h:59
0x1169381 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:52
0x1169381 Rust::Compile::CompileExpr::visit(Rust::HIR::ArithmeticOrLogicalExpr&)
	../../gcc/rust/backend/rust-compile-expr.cc:150
0x1161296 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile-expr.cc:52
0x118afb1 Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
	../../gcc/rust/backend/rust-compile-base.cc:619
0x118b9f4 Rust::Compile::HIRCompileBase::compile_constant_item(unsigned int, Rust::TyTy::BaseType*, Rust::TyTy::BaseType*, Rust::Resolver::CanonicalPath const&, Rust::HIR::Expr&, unsigned long, unsigned long)
	../../gcc/rust/backend/rust-compile-base.cc:863
0x118be84 Rust::Compile::HIRCompileBase::compile_constant_expr(Rust::Compile::Context*, unsigned int, Rust::TyTy::BaseType*, Rust::TyTy::BaseType*, Rust::Resolver::CanonicalPath const&, Rust::HIR::Expr&, unsigned long, unsigned long)
	../../gcc/rust/backend/rust-compile-base.cc:567
0x118be84 Rust::Compile::HIRCompileBase::query_compile_const_expr(Rust::Compile::Context*, Rust::TyTy::BaseType*, Rust::HIR::Expr&)
	../../gcc/rust/backend/rust-compile-base.cc:582
0x1039ad5 Rust::TyTy::SubstitutionRef::get_mappings_from_generic_args(Rust::HIR::GenericArgs&, std::vector<Rust::TyTy::Region, std::allocator<Rust::TyTy::Region> > const&)
	../../gcc/rust/typecheck/rust-tyty-subst.cc:849
0x11266b3 Rust::Resolver::SubstMapper::visit(Rust::TyTy::ADTType&)
	../../gcc/rust/typecheck/rust-substitution-mapper.cc:112
0x1125b67 Rust::Resolver::SubstMapper::Resolve(Rust::TyTy::BaseType*, unsigned long, Rust::HIR::GenericArgs*, std::vector<Rust::TyTy::Region, std::allocator<Rust::TyTy::Region> > const&)
	../../gcc/rust/typecheck/rust-substitution-mapper.cc:47
0x107b1ab Rust::Resolver::TypeCheckType::resolve_root_path(Rust::HIR::TypePath&, unsigned long*, bool*)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:461
0x107ccdf Rust::Resolver::TypeCheckType::visit(Rust::HIR::TypePath&)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:147
0x1079307 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type&)
	../../gcc/rust/typecheck/rust-hir-type-check-type.cc:71
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions