Rust-GCC / Rust-GCC/gccrs

GCCRS hangs indefinitely when processing macro with $meta:meta fragment

Open
#3,729 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.9k
Forks
231
Avg merge
19h 55m
Merged PRs (30d)
67

Description

Summary

When compiling a Rust program containing a macro that matches the meta fragment specifier, GCCRS exceeds the processing time limit and is terminated with SIGKILL. The same code compiles successfully (with warnings) under rustc.

Reproducer

I tried this code:

macro_rules! check { ($meta:meta) => () }

check!(meta(a b c d));
check!(meta[a b c d]);
check!(meta { a b c d });
check!(meta);
check!(meta = 0);

fn main() {}
Does the code make use of any (1.49) nightly feature ?
  • Nightly
Godbolt link

https://godbolt.org/z/448j6hdxG

Actual behavior

Compiler hangs indefinitely and is killed with SIGKILL (exit code 143).

Expected behavior

The code should compile successfully (possibly with warnings about unused main), or report clear errors if the macro usage is invalid.

GCC Version

14.2

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 running the Rust reproducer from the issue through GCCRS and compare it with the linked Godbolt result. Trace the macro_rules meta-fragment handling; done means the cases terminate and either compile or emit clear diagnostics rather than being killed.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.