https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103415

G. Steinmetz <gs...@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--- Comment #1 from G. Steinmetz <gs...@t-online.de> ---

Probably related :


$ cat z2.c
#define n(x...) #__VA_OPT__(x##__VA_ARGS__##c)
const char *c n(1)


$ cat z3.c
#define n(x...) = #__VA_OPT__(x##__VA_ARGS__##c)
const char *c n(1);


$ gcc-12-20211121 -c z2.c
z2.c:1:18: warning: __VA_OPT__ can only appear in the expansion of a C++20
variadic macro
    1 | #define n(x...) #__VA_OPT__(x##__VA_ARGS__##c)
      |                  ^
z2.c:1:32: warning: __VA_ARGS__ can only appear in the expansion of a C99
variadic macro
    1 | #define n(x...) #__VA_OPT__(x##__VA_ARGS__##c)
      |                                ^
z2.c:2:1: internal compiler error: Segmentation fault
    2 | const char *c n(1)
      | ^~~~~
0xcb463f crash_signal
        ../../gcc/toplev.c:322
0x18d0cca new_string_token
        ../../libcpp/macro.c:472
0x18d0cca stringify_arg
        ../../libcpp/macro.c:941
0x18d32e3 replace_args
        ../../libcpp/macro.c:2068
0x18d32e3 enter_macro_context
        ../../libcpp/macro.c:1496
0x18d3750 cpp_get_token_1
        ../../libcpp/macro.c:2986
0x7ff27d c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int)
        ../../gcc/c-family/c-lex.c:483
0x78743f c_lex_one_token
        ../../gcc/c/c-parser.c:279
0x788414 c_parser_peek_nth_token(c_parser*, unsigned int)
        ../../gcc/c/c-parser.c:517
0x7889a0 c_parser_nth_token_starts_std_attributes
        ../../gcc/c/c-parser.c:5092
0x79524b c_parser_direct_declarator
        ../../gcc/c/c-parser.c:3951
0x79524b c_parser_declarator(c_parser*, bool, c_dtr_syn, bool*)
        ../../gcc/c/c-parser.c:3894
0x795033 c_parser_declarator(c_parser*, bool, c_dtr_syn, bool*)
        ../../gcc/c/c-parser.c:3886
0x7ae573 c_parser_declaration_or_fndef
        ../../gcc/c/c-parser.c:2154
0x7b70cf c_parser_external_declaration
        ../../gcc/c/c-parser.c:1780
0x7b79fb c_parser_translation_unit
        ../../gcc/c/c-parser.c:1653
0x7b79fb c_parse_file()
        ../../gcc/c/c-parser.c:23280
0x808eb2 c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1240

Reply via email to