Rust-GCC / Rust-GCC/gccrs

ICE: segfault when passing slice to main

Open
#3,610 0 comments 0 reactions 1 assignee View on GitHub

@philberty is already working on this.

Since Mar 28, 2025.

bug
Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
20h 2m
Merged PRs (30d)
66

Description

auto-reduced (treereduce-rust):

fn main(&ref mut s: &[i32]) {}

original:

#[must_use = "iterators are lazy and do nothing unless consumed"]
//~^ ERROR an unknown tool name found in scoped lint: `foo::bar`
//~| ERROR an unknown tool name found in scoped lint: `foo::bar`
//~| ERROR an unknown tool name found in scoped lint: `foo::bar`
fn main(&ref mut s: &[i32]) {}

Version information:

4019d70517af4d6d95650eb2ee3a793c57cdbe2b

Command:
crab1 -Warray-bounds -mtune=generic -march=x86-64 -O0 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

crab1: internal compiler error: Segmentation fault
0x1702eaf crash_signal
	../../gcc/toplev.cc:319
0x1a94650 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
	../../gcc/tree.h:3766
0x1a94650 build_pointer_type_for_mode(tree_node*, machine_mode, bool)
	../../gcc/tree.cc:6966
0x128d847 build_fold_addr_expr_loc(unsigned int, tree_node*)
	../../gcc/fold-const.cc:9442
0xfd0acd Rust::Compile::CompilePatternBindings::visit(Rust::HIR::IdentifierPattern&)
	../../gcc/rust/backend/rust-compile-pattern.cc:615
0xfcefc3 ???
	../../gcc/rust/backend/rust-compile-pattern.h:83
0xfd2235 ???
	../../gcc/rust/backend/rust-compile-fnparam.h:41
0xfd1d12 Rust::Compile::CompileFnParam::compile(Rust::Compile::Context*, tree_node*, Rust::HIR::FunctionParam&, tree_node*, unsigned int)
	../../gcc/rust/backend/rust-compile-fnparam.cc:38
0x10106bf 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:740
0xfd882d Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
	../../gcc/rust/backend/rust-compile-item.cc:256
0xc64a14 Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned int)
	../../gcc/rust/backend/rust-compile-item.h:37
0xc64a14 Rust::Compile::CompileCrate::go()
	../../gcc/rust/backend/rust-compile.cc:48
0xc64afb Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile.cc:41
0xc5c50b Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:733
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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.