segfault tree_class_check / build_pointer_type_for_mode
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the backtrace: the crash is a null or invalid tree in address_expression (gcc/rust/backend/rust-compile-base.cc:631), reached from coerce_to_dyn_object (rust-compile.cc:204) via resolve_adjustments (rust-compile-expr.cc:2591). Build crab1, then run the minimal reproducer with the -frust-crate-attr=no_core flags to confirm the segfault. Done means the reproducer compiles without an internal compiler error and the dyn coercion of &mut bar.writer produces correct code.
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 Aaa {}
impl<'a> Aaa for &'a mut (Aaa + 'a) {}
struct Bar<'a> {
writer: &'a mut (Aaa + 'a),
}
fn baz(_: &mut Aaa) {}
fn foo<'a>(mut bar: Bar<'a>) {
baz(&mut bar.writer);
}
original:
// Copyright 2014 The Rust Project<!--
File: /tmp/im/gcc/issue-17771_fc821441330a5277fbd95653170fca71b33d8003.rs
-->
auto-reduced (treereduce-rust):
````rust
//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core
//
trait Aaa {}
impl<'a> Aaa for &'a mut (Aaa + 'a) {}
struct Bar<'a> {
writer: &'a mut (Aaa + 'a),
}
fn baz(_: &mut Aaa) {}
fn foo<'a>(mut bar: Bar<'a>) {
baz(&mut bar.writer);
}
original:
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// pretty-expanded FIXME #23616
trait Aaa { fn dummy(&self) { } }
impl<'a> Aaa for &'a mut (Aaa + 'a) {}
struct Bar<'a> {
writer: &'a mut (Aaa + 'a),
}
fn baz(_: &mut Aaa) {
}
fn foo<'a>(mut bar: Bar<'a>) {
baz(&mut bar.writer);
}
fn main() {
}
Version information:
a02e9a643d591708a5de6d506ef75f3405a91a0e
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: Segmentation fault
0x35dee47 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0x1b9a97f crash_signal
../../gcc/toplev.cc:325
0x202b570 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
../../gcc/tree.h:3985
0x202b570 build_pointer_type_for_mode(tree_node*, machine_mode, bool)
../../gcc/tree.cc:7237
0x12edaec Rust::Compile::HIRCompileBase::address_expression(tree_node*, unsigned long, tree_node*)
../../gcc/rust/backend/rust-compile-base.cc:631
0xf9a6d0 Rust::Compile::HIRCompileBase::coerce_to_dyn_object(tree_node*, Rust::TyTy::BaseType*, Rust::TyTy::DynamicObjectType const*, unsigned long)
../../gcc/rust/backend/rust-compile.cc:204
0x12c11f0 Rust::Compile::HIRCompileBase::resolve_adjustments(std::vector<Rust::Resolver::Adjustment, std::allocator<Rust::Resolver::Adjustment> >&, tree_node*, unsigned long)
../../gcc/rust/backend/rust-compile-expr.cc:2591
0xf98ce3 Rust::Compile::HIRCompileBase::coercion_site(unsigned int, tree_node*, Rust::TyTy::BaseType*, Rust::TyTy::BaseType*, unsigned long, unsigned long)
../../gcc/rust/backend/rust-compile.cc:67
0x12c3d30 Rust::Compile::CompileExpr::visit(Rust::HIR::CallExpr&)
../../gcc/rust/backend/rust-compile-expr.cc:1820
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.gDdyZYBrYJLi/rustc_testrunner_tmpdir_reporting.wdjSE3GP9BIT/mvce.rs -o/tmp/icemaker_global_tempdir.gDdyZYBrYJLi/rustc_testrunner_tmpdir_reporting.wdjSE3GP9BIT/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.
Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// pretty-expanded FIXME #23616
trait Aaa { fn dummy(&self) { } }
impl<'a> Aaa for &'a mut (Aaa + 'a) {}
struct Bar<'a> {
writer: &'a mut (Aaa + 'a),
}
fn baz(_: &mut Aaa) {
}
fn foo<'a>(mut bar: Bar<'a>) {
baz(&mut bar.writer);
}
fn main() {
}
Version information:
a02e9a643d591708a5de6d506ef75f3405a91a0e
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)`
<details><summary><strong>Program output</strong></summary>
<p>
```
crab1: internal compiler error: Segmentation fault
0x35dee47 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0x1b9a97f crash_signal
../../gcc/toplev.cc:325
0x202b570 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
../../gcc/tree.h:3985
0x202b570 build_pointer_type_for_mode(tree_node*, machine_mode, bool)
../../gcc/tree.cc:7237
0x12edaec Rust::Compile::HIRCompileBase::address_expression(tree_node*, unsigned long, tree_node*)
../../gcc/rust/backend/rust-compile-base.cc:631
0xf9a6d0 Rust::Compile::HIRCompileBase::coerce_to_dyn_object(tree_node*, Rust::TyTy::BaseType*, Rust::TyTy::DynamicObjectType const*, unsigned long)
../../gcc/rust/backend/rust-compile.cc:204
0x12c11f0 Rust::Compile::HIRCompileBase::resolve_adjustments(std::vector<Rust::Resolver::Adjustment, std::allocator<Rust::Resolver::Adjustment> >&, tree_node*, unsigned long)
../../gcc/rust/backend/rust-compile-expr.cc:2591
0xf98ce3 Rust::Compile::HIRCompileBase::coercion_site(unsigned int, tree_node*, Rust::TyTy::BaseType*, Rust::TyTy::BaseType*, unsigned long, unsigned long)
../../gcc/rust/backend/rust-compile.cc:67
0x12c3d30 Rust::Compile::CompileExpr::visit(Rust::HIR::CallExpr&)
../../gcc/rust/backend/rust-compile-expr.cc:1820
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.gDdyZYBrYJLi/rustc_testrunner_tmpdir_reporting.wdjSE3GP9BIT/mvce.rs -o/tmp/icemaker_global_tempdir.gDdyZYBrYJLi/rustc_testrunner_tmpdir_reporting.wdjSE3GP9BIT/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.
```
</p>
</details>
- 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
-
area/ysql kind/bug priority/medium status/awaiting-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
yugabyte/yugabyte-db#37523 ·
Maintainers usually reply within 1 day
-
mlir
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
llvm/llvm-project#241070 · 1 comment ·
Maintainers usually reply within 1 day
-
backlog documentation
Difficulty 1/5 Under an hour Newbie friendliness 96/100
EchoTools/nevr-runtime#2354 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
help wanted new command
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
tldr-pages/tldr#25111 ·
Maintainers usually reply within 1 day