ICE in get_fn_addr_from_dyn, at rust/backend/rust-compile-expr.cc
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
The crash is in get_fn_addr_from_dyn in gcc/rust/backend/rust-compile-expr.cc, reached from CompileExpr::visit(MethodCallExpr) around line 1915. Start by reproducing the reduced trait A / fn foo(x: &dyn A) / A.test() case with the crab1 flags listed in the issue, then read how the dyn object type's method is resolved. Done means the reduced case no longer hits the internal error and the method call on the trait object is compiled.
Written by the indexing model from the issue text.
Description
auto-reduced (treereduce-rust):
//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core
trait A {
fn test(&self);
}
fn foo(x: &dyn A) {
A.test();
}
original:
//@ run-pass
// Check that the object bound dyn A + 'a: A is preferred over the
// where clause bound dyn A + 'static: A.
#![allow(unused)]
trait A {
fn test(&self);
}
fn foo(x: &dyn A)
where
dyn A + 'static: A, // Using this bound would lead to a lifetime error.
{
A.test();
}
fn main () {}
Version information:
a02e9a643d591708a5de6d506ef75f3405a91a0e
Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/a02e9a643d591708a5de6d506ef75f3405a91a0e/gcc/rust/backend/rust-compile-expr.cc#L1983-L1995
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core -frust-crate-attr=feature(no_core)
Program output
crab1: internal compiler error: in get_fn_addr_from_dyn, at rust/backend/rust-compile-expr.cc:1989
0x35dee47 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0xd2fe75 fancy_abort(char const*, int, char const*)
../../gcc/diagnostics/context.cc:1813
0x93ba4d Rust::Compile::CompileExpr::get_fn_addr_from_dyn(Rust::TyTy::DynamicObjectType const*, Rust::TyTy::BaseType*, Rust::TyTy::FnType*, tree_node*, unsigned long)
../../gcc/rust/backend/rust-compile-expr.cc:1989
0x12c1973 Rust::Compile::CompileExpr::visit(Rust::HIR::MethodCallExpr&)
../../gcc/rust/backend/rust-compile-expr.cc:1915
0x12b59d6 Rust::Compile::CompileExpr::Compile(Rust::HIR::Expr&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-expr.cc:164
0x12ab5f0 ???
../../gcc/rust/backend/rust-compile-stmt.h:33
0x12abe7c Rust::Compile::CompileStmt::Compile(Rust::HIR::Stmt*, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile-stmt.cc:39
0x12edb8b Rust::Compile::HIRCompileBase::compile_function_body(tree_node*, Rust::HIR::BlockExpr&, Rust::TyTy::BaseType*)
../../gcc/rust/backend/rust-compile-base.cc:683
0x12ef412 Rust::Compile::HIRCompileBase::compile_function(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tl::optional<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 long, Rust::HIR::BlockExpr*, Rust::Resolver::CanonicalPath const&, Rust::TyTy::FnType*)
../../gcc/rust/backend/rust-compile-base.cc:922
0x12a9e4d Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
../../gcc/rust/backend/rust-compile-item.cc:283
0xf98b1b Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned long)
../../gcc/rust/backend/rust-compile-item.h:37
0xf98b1b Rust::Compile::CompileCrate::go()
../../gcc/rust/backend/rust-compile.cc:49
0xf98b1b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile.cc:42
0xf82d9c Rust::Session::compile_crate(char const*)
../../gcc/rust/rust-session-manager.cc:862
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.2Zk2ZzLJdIQG/rustc_testrunner_tmpdir_reporting.V35g0DJY6vxw/mvce.rs -o/tmp/icemaker_global_tempdir.2Zk2ZzLJdIQG/rustc_testrunner_tmpdir_reporting.V35g0DJY6vxw/binaryname -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core -frust-crate-attr=feature(no_core)
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.
- Dominant language
- C++
- Stars
- 3k
- Forks
- 238
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 31
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Rust-GCC/gccrs
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 3 days
-
Allow pattern matching of floating point literalsPossibly taken @Vivekkumar0995 claimed this 7 days ago. Opencleanup good-first-pr typechecking
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Rust-GCC/gccrs#5047 · 3 comments · 1 assignee ·
Maintainers usually reply within 3 days
-
ICE in variance analysis on core, projection field keeps the impl's type paramPossibly taken @u7k4rs6 claimed this 1 day ago. Opentypechecking
Rust-GCC/gccrs#5074 · 1 assignee ·
Maintainers usually reply within 3 days
-
subset-error typechecking
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 3 days
-
Difficulty 3/5 1-2 days Newbie friendliness 46/100
Rust-GCC/gccrs#5060 · 2 comments ·
Maintainers usually reply within 3 days
Similar issues
-
help wanted new command
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
tldr-pages/tldr#25111 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
bug test
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
OpenAssetIO/OpenAssetIO#1527 ·
-
iOS Fabric pointer-handler reset leaves the next lone touch non-primaryPossibly taken @alleneubank claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
react/react-native#59919 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
ROCm/rocm-systems#15475 ·
Maintainers usually reply within 2 days