llvm / llvm/llvm-project

Recursive macro expansion triggers clang crash

Open
#194,804 3 comments 0 reactions 0 assignees View on GitHub
clang:frontend crash-on-valid needs-reduction
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Compiling:

$ clang-20 -std=gnu2x -O0 -c ../macro-expansion-repro.c

Causes the included crash.

This is a simplified version of a more elaborate chain in my library [libfyaml](https://github.com/pantoniou/libfyaml)
and triggers in a much reduced nesting level.

[clang-crash.txt](https://github.com/user-attachments/files/27193578/clang-crash.txt)

[macro-expansion-repro.c](https://github.com/user-attachments/files/27193581/macro-expansion-repro.c)

[macro-expansion-repro-9dfd14.sh](https://github.com/user-attachments/files/27193776/macro-expansion-repro-9dfd14.sh)

[macro-expansion-repro-9dfd14.c](https://github.com/user-attachments/files/27193780/macro-expansion-repro-9dfd14.c)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.