Rust-GCC / Rust-GCC/gccrs

ICE in handle_inline_attribute_on_fndecl, at rust/backend/rust-compile-base.cc:369 inline attr w param

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

Nobody has claimed this yet.

bug good-first-pr
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
#[inline = ""]
fn main() {}

original:

#[inline = ""] //~ ERROR unexpected token: `!`
fn main() {}

Version information:

765121736dfe3f5b319bbe9837880deda326394e

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/765121736dfe3f5b319bbe9837880deda326394e/gcc/rust/backend/rust-compile-base.cc#L363-L375

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 handle_inline_attribute_on_fndecl, at rust/backend/rust-compile-base.cc:369
0x89bb51 Rust::Compile::HIRCompileBase::handle_inline_attribute_on_fndecl(tree_node*, Rust::AST::Attribute const&)
	../../gcc/rust/backend/rust-compile-base.cc:369
0x10a0e8b Rust::Compile::HIRCompileBase::setup_fndecl(tree_node*, bool, bool, Rust::HIR::Visibility&, Rust::HIR::FunctionQualifiers const&, std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> > const&)
	../../gcc/rust/backend/rust-compile-base.cc:101
0x10a16fd 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:695
0x1068b2d Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
	../../gcc/rust/backend/rust-compile-item.cc:256
0xcf15f4 Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned int)
	../../gcc/rust/backend/rust-compile-item.h:37
0xcf15f4 Rust::Compile::CompileCrate::go()
	../../gcc/rust/backend/rust-compile.cc:48
0xcf16db Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile.cc:41
0xce90eb 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.

Research direction

Start by compiling the reduced Rust snippet in the issue with -frust-incomplete-and-experimental-compiler-do-not-use and reproduce the ICE. Then inspect handle_inline_attribute_on_fndecl in rust/backend/rust-compile-base.cc around line 369, using the provided backtrace to follow setup_fndecl. Done means the input no longer triggers an internal compiler error and produces the expected diagnostic.

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
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.