gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

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

Open starbugs-qurong opened this issue 8 months ago • 0 comments

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

starbugs-qurong avatar Apr 10 '25 09:04 starbugs-qurong