https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116002
Bug ID: 116002 Summary: GCC Compiler Hang with Recursive Macros in Function Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- Target: x86_64 ******************************************************************************* I encountered an issue where the GCC compiler hangs indefinitely while trying to compile a specific piece of code involving recursive macros within a function. The code snippet is provided below.Clang also has this problem. ******************************************************************************* OS and Platform: # uname -a Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-15/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /root/gdbtest/gcc/obj/../gcc/configure --prefix=/root/gdbtest/gcc/gcc-15 --enable-languages=c,c++,fortran,go --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240509 (experimental) (GCC) ******************************************************************************* Program: # cat 1.c int a(int c) { if (c < 12345) { #define A \ { int d = c % 12345; \ int e = c ^ d * 12345; \ int f = c * d % e % 12345; \ c = f; } #define B A A A A A A #define C B B B B B B #define D C C C C C C #define E D D D D D D E E E E E } return c; } ******************************************************************************* Output: Nothing (Waited for nearly 300 seconds. ******************************************************************************* Also got killed on compiler explorer:https://godbolt.org/z/9Exof1rrW *******************************************************************************