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

            Bug ID: 92355
           Summary: ICE: Segmentation fault crash_signal toplev.c:325
           Product: gcc
           Version: 8.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anbu1024.me at gmail dot com
  Target Milestone: ---

$ cat test.c 
void foo ( ) 
{ 
    void bar() char str[({ void func(){ int x; } )]; 
}


My gcc-8's snapshot version is gcc-8-20191101


$ gcc-snapshot8 -v
Using built-in specs.
COLLECT_GCC=/home/tom/Documents/gcc/8-20191101/install/bin/gcc
COLLECT_LTO_WRAPPER=/home/tom/Documents/gcc/8-20191101/install/libexec/gcc/x86_64-pc-linux-gnu/8.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-8-20191101/configure
--prefix=/home/tom/Documents/gcc/8-20191101/install --enable-languages=c,c++
--disable-multilib
Thread model: posix
gcc version 8.3.1 20191101 (GCC) 


$ gcc-snapshot8 test.c 
test.c: In function ‘bar’:
test.c:3:5: internal compiler error: Segmentation fault
     void bar() char str[({ void func(){ int x; } )];
     ^~~~
0xa6512f crash_signal
        ../../gcc-8-20191101/gcc/toplev.c:325
0x5fe28f c_push_function_context()
        ../../gcc-8-20191101/gcc/c/c-decl.c:9710
0x63bbec c_parser_declaration_or_fndef
        ../../gcc-8-20191101/gcc/c/c-parser.c:2245
0x63a3da c_parser_compound_statement_nostart
        ../../gcc-8-20191101/gcc/c/c-parser.c:5002
0x621ca7 c_parser_postfix_expression
        ../../gcc-8-20191101/gcc/c/c-parser.c:8007
0x6292a2 c_parser_unary_expression
        ../../gcc-8-20191101/gcc/c/c-parser.c:7323
0x62a07f c_parser_cast_expression
        ../../gcc-8-20191101/gcc/c/c-parser.c:7167
0x62a2f3 c_parser_binary_expression
        ../../gcc-8-20191101/gcc/c/c-parser.c:6970
0x62b0c5 c_parser_conditional_expression
        ../../gcc-8-20191101/gcc/c/c-parser.c:6708
0x62b600 c_parser_expr_no_commas
        ../../gcc-8-20191101/gcc/c/c-parser.c:6625
0x6285b0 c_parser_direct_declarator_inner
        ../../gcc-8-20191101/gcc/c/c-parser.c:3818
0x63adf0 c_parser_declaration_or_fndef
        ../../gcc-8-20191101/gcc/c/c-parser.c:1988
0x63bace c_parser_declaration_or_fndef
        ../../gcc-8-20191101/gcc/c/c-parser.c:2305
0x63a3da c_parser_compound_statement_nostart
        ../../gcc-8-20191101/gcc/c/c-parser.c:5002
0x63a526 c_parser_compound_statement
        ../../gcc-8-20191101/gcc/c/c-parser.c:4914
0x63bb83 c_parser_declaration_or_fndef
        ../../gcc-8-20191101/gcc/c/c-parser.c:2343
0x64169f c_parser_external_declaration
        ../../gcc-8-20191101/gcc/c/c-parser.c:1643
0x641ed9 c_parser_translation_unit
        ../../gcc-8-20191101/gcc/c/c-parser.c:1524
0x641ed9 c_parse_file()
        ../../gcc-8-20191101/gcc/c/c-parser.c:18493
0x6847c6 c_common_parse_file()
        ../../gcc-8-20191101/gcc/c-family/c-opts.c:1147
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


I test it with gcc-7.4.0, the result is following


$ gcc-7.4.0 -v
Using built-in specs.
COLLECT_GCC=/home/tom/Documents/gcc/7.4.0/install/bin/gcc
COLLECT_LTO_WRAPPER=/home/tom/Documents/gcc/7.4.0/install/libexec/gcc/x86_64-pc-linux-gnu/7.4.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-7.4.0/configure
--prefix=/home/tom/Documents/gcc/7.4.0/install --enable-languages=c,c++
--disable-multilib
Thread model: posix
gcc version 7.4.0 (GCC) 


$ gcc-7.4.0 test.c 
test.c: In function ‘bar’:
test.c:3:5: internal compiler error: Segmentation fault
     void bar() char str[({ void func(){ int x; } )];
     ^~~~
0x9d957f crash_signal
        ../../gcc-7.4.0/gcc/toplev.c:337
0x599171 c_push_function_context()
        ../../gcc-7.4.0/gcc/c/c-decl.c:9516
0x5bd964 c_parser_declaration_or_fndef
        ../../gcc-7.4.0/gcc/c/c-parser.c:2051
0x5d1dca c_parser_compound_statement_nostart
        ../../gcc-7.4.0/gcc/c/c-parser.c:4841
0x5d53f4 c_parser_postfix_expression
        ../../gcc-7.4.0/gcc/c/c-parser.c:7678
0x5c362a c_parser_unary_expression
        ../../gcc-7.4.0/gcc/c/c-parser.c:7061
0x5c4307 c_parser_cast_expression
        ../../gcc-7.4.0/gcc/c/c-parser.c:6893
0x5c4512 c_parser_binary_expression
        ../../gcc-7.4.0/gcc/c/c-parser.c:6702
0x5c4fc5 c_parser_conditional_expression
        ../../gcc-7.4.0/gcc/c/c-parser.c:6470
0x5c54c0 c_parser_expr_no_commas
        ../../gcc-7.4.0/gcc/c/c-parser.c:6387
0x5ced8d c_parser_direct_declarator_inner
        ../../gcc-7.4.0/gcc/c/c-parser.c:3603
0x5bc7bf c_parser_declaration_or_fndef
        ../../gcc-7.4.0/gcc/c/c-parser.c:1796
0x5bce1f c_parser_declaration_or_fndef
        ../../gcc-7.4.0/gcc/c/c-parser.c:2085
0x5d1dca c_parser_compound_statement_nostart
        ../../gcc-7.4.0/gcc/c/c-parser.c:4841
0x5d20fe c_parser_compound_statement
        ../../gcc-7.4.0/gcc/c/c-parser.c:4752
0x5bd864 c_parser_declaration_or_fndef
        ../../gcc-7.4.0/gcc/c/c-parser.c:2125
0x5daed3 c_parser_external_declaration
        ../../gcc-7.4.0/gcc/c/c-parser.c:1468
0x5db949 c_parser_translation_unit
        ../../gcc-7.4.0/gcc/c/c-parser.c:1349
0x5db949 c_parse_file()
        ../../gcc-7.4.0/gcc/c/c-parser.c:18183
0x61fad3 c_common_parse_file()
        ../../gcc-7.4.0/gcc/c-family/c-opts.c:1107
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to