segfault DefaultHIRVisitor, macros
Open
Nobody has claimed this yet.
bug
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 231
- Avg merge
- 20h 2m
- Merged PRs (30d)
- 66
Description
auto-reduced (treereduce-rust):
//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
macro x(
$macro_name:ident,
$macro2_name:ident,
$type_name:ident,
$field_name:ident,
$const_name:ident
) {
pub struct $type_name {}
pub const $const_name: $type_name = $type_name {};
#[x]
macro_rules! $macro_name {
() => {};
}
pub macro $type_name {
(Copy $e:expr) => {},
() => {;},
}
}
x!(test_fields, test_fields2, x, field, MY_CONST);
pub fn check_fields_local() {
test_fields!(check_fields);
}
original:
macro x(
$macro_name:ident,
$macro2_name:ident,
$type_name:ident,
$field_name:ident,
$const_name:ident
) {
pub struct $type_name {}
pub const $const_name: $type_name = $type_name {};
#[x]
macro_rules! $macro_name {
(check_fields) => {{
assert_eq!($const_name.field, Field::MacroCtxt);
}};
}
pub macro $type_name {
(Copy $e:expr) => {},
(check_fields) => {test_fields!(check_fields);},
}
}
x!(test_fields, test_fields2, x, field, MY_CONST);
pub fn check_fields_local() {
test_fields!(check_fields);
test_fields2!(check_fields);
}
Version information:
5a762b9243e834d69f90985950f4ef330f16b34f
Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use
Program output
/tmp/icemaker_global_tempdir.CmTzlVK6SkSa/rustc_testrunner_tmpdir_reporting.EhADlG9zJYJK/mvce.rs:12:7: error: macro not found
12 | #[x]
| ^
crab1: internal compiler error: Segmentation fault
0x301f909 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:786
0x199fb9f crash_signal
../../gcc/toplev.cc:323
0x0 Rust::HIR::DefaultHIRVisitor::visit(Rust::HIR::TupleType&)
../../gcc/rust/hir/tree/rust-hir-visitor.h:333
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 crash with the reduced Rust source and the listed crab1 command, using the reported revision 5a762b9243e834d69f90985950f4ef330f16b34f. Start at Rust::HIR::DefaultHIRVisitor::visit(Rust::HIR::TupleType&) in gcc/rust/hir/tree/rust-hir-visitor.h and use the reported backtrace to trace the failing visitor path. Done means the reproducer no longer causes a segmentation fault.
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