ICE `in handle_must_use_attribute_on_fndecl, at rust/backend/rust-compile-base.cc` malformed must use attr
Nobody has claimed this yet.
- 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
#[must_use(S::field)]
pub fn main() {}
original:
#[must_use(S::field)] //~ ERROR use of unstable library feature 'cfg_accessible'
pub fn main() {
}
Version information:
5c3e2adc695b04a199d37cacd8c23b14fdab914f
Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/5c3e2adc695b04a199d37cacd8c23b14fdab914f/gcc/rust/backend/rust-compile-base.cc#L413-L425
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_must_use_attribute_on_fndecl, at rust/backend/rust-compile-base.cc:419
0x2fec938 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:517
0xc0dfbb fancy_abort(char const*, int, char const*)
../../gcc/diagnostic.cc:1803
0x90fd15 Rust::Compile::HIRCompileBase::handle_must_use_attribute_on_fndecl(tree_node*, Rust::AST::Attribute const&)
../../gcc/rust/backend/rust-compile-base.cc:419
0x118c67b 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:105
0x118cd3e 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:713
0x1157e91 Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
../../gcc/rust/backend/rust-compile-item.cc:220
0xdbee6b Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned long)
../../gcc/rust/backend/rust-compile-item.h:37
0xdbee6b Rust::Compile::CompileCrate::go()
../../gcc/rust/backend/rust-compile.cc:48
0xdbee6b Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
../../gcc/rust/backend/rust-compile.cc:41
0xdb98f0 Rust::Session::compile_crate(char const*)
../../gcc/rust/rust-session-manager.cc:732
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
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.
Research direction
Start in gcc/rust/backend/rust-compile-base.cc, especially handle_must_use_attribute_on_fndecl around lines 413-425, and reproduce the ICE with the reduced Rust input and compiler command shown. Trace setup_fndecl's handling of #[must_use(S::field)] and ensure malformed input no longer aborts internally; verify the command completes with an appropriate diagnostic instead of the reported ICE.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100