https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119184
Bug ID: 119184
Summary: internal compiler error: in tokens_buff_and_token
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: xieym3 at zohomail dot com
Target Milestone: ---
The following code triggers an internal compiler error (ICE) with GCC 11.2.0
and 14.2.0, causes a compilation timeout with GCC trunk versions.
$ timeout 300 gcc -x c -std=c2x 979-reduced.c
979-reduced.c: In function ‘main’:
979-reduced.c:3:3: internal compiler error: in tokens_buff_add_token, at
libcpp/macro.cc:2619
3 | float x = max(
| ^~~~~
0x507ddf0 tokens_buff_add_token
/data/xieym/llm/src/gcc-14.2.0/libcpp/macro.cc:2619
0x507fcb2 replace_args
/data/xieym/llm/src/gcc-14.2.0/libcpp/macro.cc:2299
0x507fcb2 enter_macro_context
/data/xieym/llm/src/gcc-14.2.0/libcpp/macro.cc:1492
0x5080d7f cpp_get_token_1
/data/xieym/llm/src/gcc-14.2.0/libcpp/macro.cc:3027
0xfb4f14 get_token
/data/xieym/llm/src/gcc-14.2.0/gcc/c-family/c-lex.cc:311
0xfb602b c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int)
/data/xieym/llm/src/gcc-14.2.0/gcc/c-family/c-lex.cc:572
0xe308a1 c_lex_one_token
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:311
0xe3127f c_parser_peek_token(c_parser*)
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:515
0xe38074 c_parser_declaration_or_fndef
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:2700
0xe4d3b8 c_parser_compound_statement_nostart
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:7135
0xe49cfb c_parser_compound_statement
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:6531
0xe39a2f c_parser_declaration_or_fndef
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:3017
0xe350c3 c_parser_external_declaration
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:2046
0xe345a7 c_parser_translation_unit
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:1900
0xec8a1e c_parse_file()
/data/xieym/llm/src/gcc-14.2.0/gcc/c/c-parser.cc:26887
0xfea394 c_common_parse_file()
/data/xieym/llm/src/gcc-14.2.0/gcc/c-family/c-opts.cc:1311
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.
$ cat 979-reduced.c
#define max(X, Y) (((X) >= (Y)) ? (X) : (Y))
void main(void) {
float x = max(
x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
max(x,
x))))))))))))))))))))))))))));
Reproduction link: https://godbolt.org/z/q5aaf8coG