ICE `in get_receiver_expr, at rust/ast/rust-expr.h` cfg'd out return
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
impl Point {
fn distance_squared(&self) -> f32 {
#[cfg(cfail2)]
self.x += x;
}
}
original:
pub struct Point {
pub x: f32,
pub y: f32,
}
impl Point {
fn distance_squared(&self) -> f32 {
#[cfg(cfail1)]
return self.x + self.distance_squared;
#[cfg(cfail2)]
self.x += x;
}
pub fn distance_from_origin(&self) -> f32 {
self.distance_squared().sqrt()
}
}
impl Point {
pub fn translate(&mut self, distance_squared: f32, y: f32) {
self.x += x;
self.y += y;
}
}
Version information:
5c3e2adc695b04a199d37cacd8c23b14fdab914f
Possibly related line of code:
https://github.com/Rust-GCC/gccrs/blob/5c3e2adc695b04a199d37cacd8c23b14fdab914f/gcc/rust/ast/rust-expr.h#L2358-L2370
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use
Program output
/tmp/icemaker_global_tempdir.3aCk8mwR4GuC/rustc_testrunner_tmpdir_reporting.0l4ziNcjpCmz/mvce.rs:4:9: error: cannot strip expression in this position - outer attributes are never allowed before binary op exprs
4 | self.x += x;
| ^~~~
/tmp/icemaker_global_tempdir.3aCk8mwR4GuC/rustc_testrunner_tmpdir_reporting.0l4ziNcjpCmz/mvce.rs:4:9: error: cannot strip expression in this position - outer attributes are never allowed before binary op exprs
/tmp/icemaker_global_tempdir.3aCk8mwR4GuC/rustc_testrunner_tmpdir_reporting.0l4ziNcjpCmz/mvce.rs:4:9: error: cannot strip expression in this position - outer attributes are never allowed before binary op exprs
/tmp/icemaker_global_tempdir.3aCk8mwR4GuC/rustc_testrunner_tmpdir_reporting.0l4ziNcjpCmz/mvce.rs:4:9: error: cannot strip expression in this position - outer attributes are never allowed before binary op exprs
crab1: internal compiler error: in get_receiver_expr, at rust/ast/rust-expr.h:2364
0x2fec938 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:517
0xc0dfbb fancy_abort(char const*, int, char const*)
../../gcc/diagnostic.cc:1803
0x8fbbf5 Rust::AST::FieldAccessExpr::get_receiver_expr()
../../gcc/rust/ast/rust-expr.h:2364
0x8fbbf5 Rust::AST::DefaultASTVisitor::visit(Rust::AST::FieldAccessExpr&)
../../gcc/rust/ast/rust-ast-visitor.cc:435
0x8fbbf5 Rust::AST::DefaultASTVisitor::visit(Rust::AST::FieldAccessExpr&)
../../gcc/rust/ast/rust-ast-visitor.cc:432
0xd6ebb0 void Rust::AST::DefaultASTVisitor::visit<Rust::AST::Expr>(Rust::AST::Expr&)
../../gcc/rust/ast/rust-ast-visitor.h:412
0xd6ebb0 Rust::AST::DefaultASTVisitor::visit(Rust::AST::CompoundAssignmentExpr&)
../../gcc/rust/ast/rust-ast-visitor.cc:303
0xd6e78f void Rust::AST::DefaultASTVisitor::visit<Rust::AST::Stmt>(std::unique_ptr<Rust::AST::Stmt, std::default_delete<Rust::AST::Stmt> >&)
../../gcc/rust/ast/rust-ast-visitor.h:416
0xd6e78f Rust::AST::DefaultASTVisitor::visit(Rust::AST::BlockExpr&)
../../gcc/rust/ast/rust-ast-visitor.cc:453
0xf7ffa8 std::function<void ()>::operator()() const
/usr/include/c++/15.1.1/bits/std_function.h:593
0xf7ffa8 Rust::Resolver2_0::NameResolutionContext::scoped(Rust::Resolver2_0::Rib::Kind, unsigned int, std::function<void ()>, tl::optional<Rust::Identifier>)
../../gcc/rust/resolve/rust-name-resolution-context.cc:283
0xf8471c Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::BlockExpr&)
../../gcc/rust/resolve/rust-default-resolver.cc:50
0xf88ca9 operator()
../../gcc/rust/resolve/rust-default-resolver.cc:72
0xf88ca9 scope_inner<Rust::Resolver2_0::CanonicalPathCtx::scope<Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()> >(Rust::NodeId, std::string, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()>&&)::<lambda()>, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()> >
../../gcc/rust/resolve/rust-name-resolution-context.h:470
0xf88ca9 scope<Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()> >
../../gcc/rust/resolve/rust-name-resolution-context.h:413
0xf88ca9 scope<Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()> >
../../gcc/rust/resolve/rust-name-resolution-context.h:406
0xf88ca9 operator()
../../gcc/rust/resolve/rust-default-resolver.cc:75
0xf88ca9 __invoke_impl<void, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()>&>
/usr/include/c++/15.1.1/bits/invoke.h:63
0xf88ca9 __invoke_r<void, Rust::Resolver2_0::DefaultResolver::visit(Rust::AST::Function&)::<lambda()>&>
/usr/include/c++/15.1.1/bits/invoke.h:113
0xf88ca9 _M_invoke
/usr/include/c++/15.1.1/bits/std_function.h:292
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
Reproduce the reduced Rust input with -frust-incomplete-and-experimental-compiler-do-not-use, then inspect rust/ast/rust-expr.h:2358-2370 and FieldAccessExpr::get_receiver_expr() in the visitor path shown by the backtrace. Done means this input no longer triggers an internal compiler error while retaining the reported diagnostics.
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