Rust-GCC / Rust-GCC/gccrs

ICE `in check_cfg_predicate, at rust/ast/rust-ast.cc:4040` `#![cfg(feature = feature)]`

Open
#4,154 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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
#![cfg(feature = feature)]

original:

#![cfg(feature = feature)]

Version information:

4db0cf74f64086e2bb2eff029c597239df8442e1

Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/4db0cf74f64086e2bb2eff029c597239df8442e1/gcc/rust/ast/rust-ast.cc#L4034-L4046

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 check_cfg_predicate, at rust/ast/rust-ast.cc:4040
0x301e249 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:786
0xc22881 fancy_abort(char const*, int, char const*)
	../../gcc/diagnostics/context.cc:1787
0x900a5d Rust::AST::MetaItemPathExpr::check_cfg_predicate(Rust::Session const&) const
	../../gcc/rust/ast/rust-ast.cc:4040
0x900a5d Rust::AST::MetaItemPathExpr::check_cfg_predicate(Rust::Session const&) const
	../../gcc/rust/ast/rust-ast.cc:4037
0xdf160c Rust::AST::Attribute::check_cfg_predicate(Rust::Session const&) const
	../../gcc/rust/ast/rust-ast.cc:4196
0xeac38e Rust::CfgStrip::fails_cfg_with_expand(std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >&) const
	../../gcc/rust/expand/rust-cfg-strip.cc:75
0xeaee66 Rust::CfgStrip::visit(Rust::AST::Crate&)
	../../gcc/rust/expand/rust-cfg-strip.cc:156
0xe7a118 Rust::Session::expansion(Rust::AST::Crate&, Rust::Resolver2_0::NameResolutionContext&)
	../../gcc/rust/rust-session-manager.cc:943
0xe87165 Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:618
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 reproducing the reduced case with crab1 and the listed compile flag, then read rust/ast/rust-ast.cc around lines 4034-4046 and the reported CfgStrip call path. Done means the input no longer triggers an internal compiler error; add regression coverage if the repository’s existing compiler tests identify a suitable location.

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
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.