Rust-GCC / Rust-GCC/gccrs

segfault pp_token_begin_quote

Open
#4,677 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 -frust-crate-attr=no_core
/// 1

/// 6
#[print_attr(nodebug)]
macro_rules! ice {

    ( ice; ) => {

        ice!
    };
    ( { ice; } ) => {
        !;

        !
    };

}

ice! {
    ice;
}

original:


/// 1
#[rustfmt::attr2]
#[doc = "3"]
#[print_attr(nodebug)]
#[doc = "4"]
#[rustfmt::attr5]
/// 6
#[print_attr(nodebug)]
macro_rules! ice {
    // Entry point
    ( ice; ) => {
        // Just add braces
        ice! {{ ice; }}
    };
    ( { ice; } ) => {
        log_syntax!("Done");

        ice! { { } ice; }
    };
    ( { } ice; ) => {
        log_syntax!("Done");

        pub trait ThisWillIce {
            log_syntax!("Oh no!");
        }
    }
}

ice! {
    ice;
}

fn main() {
}

Version information:

cbf530387eaad3a200962a0937fea59fb0fca0a8

Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core

Program output

/tmp/icemaker_global_tempdir.hvweQOVIBZSr/rustc_testrunner_tmpdir_reporting.dCzRs7wYWp4p/mvce.rs:4:3: error: macro not found
    4 | #[print_attr(nodebug)]
      |   ^~~~~~~~~~
crab1: internal compiler error: Segmentation fault
0x32cc087 internal_error(char const*, ...)
	../../gcc/diagnostic-global-context.cc:787
0x1a8a0ff crash_signal
	../../gcc/toplev.cc:325
0x0 pp_token_begin_quote::~pp_token_begin_quote()
	../../gcc/../libcpp/include/label-text.h:38
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 /tmp/icemaker_global_tempdir.hvweQOVIBZSr/rustc_testrunner_tmpdir_reporting.dCzRs7wYWp4p/mvce.rs -o/tmp/icemaker_global_tempdir.hvweQOVIBZSr/rustc_testrunner_tmpdir_reporting.dCzRs7wYWp4p/binaryname -frust-incomplete-and-experimental-compiler-do-not-use -frust-crate-attr=no_core
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

Reproduce the crash with the reduced Rust input and the provided crab1 command, then inspect the backtrace around pp_token_begin_quote in label-text.h. Done means the input reports the macro error without a segmentation fault or internal compiler crash.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.