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

            Bug ID: 115786
           Summary: ICE: Segmentation fault (add_stmt  at
                    ./gcc/gcc/c/c-decl.cc:689 and
                    c_parser_declaration_or_fndef at
                    ./gcc/gcc/c/c-parser.cc:3027)
           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

*******************************************************************************
The compiler produces a segfault during add_stmt  at ./gcc/gcc/c/c-decl.cc:689
and  c_parser_declaration_or_fndef at ./gcc/gcc/c/c-parser.cc:3027 when
compiling the provided code with the specified options. 
The issue can also be reproduced on Compiler Explorer.

*******************************************************************************
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 test000.c
a() {
  void __GIMPLE b()


*******************************************************************************
Command Lines:
# gcc test000.c -fdump-tree-gimple -fdump-tree-all -O2 -Wall -c -o test000.o
test000.c:1:1: error: return type defaults to ‘int’ [-Wimplicit-int]
    1 | a() {
      | ^
test000.c: In function ‘a’:
test000.c:2:8: error: ‘__GIMPLE’ only valid with ‘-fgimple’
    2 |   void __GIMPLE b()
      |        ^~~~~~~~
test000.c: In function ‘b’:
test000.c:3: error: expected ‘{’ at end of input
test000.c:2:3: internal compiler error: Segmentation fault
    2 |   void __GIMPLE b()
      |   ^~~~
0x10a70ff crash_signal
        /root/gdbtest/gcc/obj/../gcc/gcc/toplev.cc:319
0x9cbf89 add_stmt(tree_node*)
        /root/gdbtest/gcc/obj/../gcc/gcc/c/c-decl.cc:689
0xa505d9 c_parser_declaration_or_fndef
        /root/gdbtest/gcc/obj/../gcc/gcc/c/c-parser.cc:3027
0xa24935 c_parser_compound_statement_nostart
        /root/gdbtest/gcc/obj/../gcc/gcc/c/c-parser.cc:7135
0xa4e304 c_parser_compound_statement
        /root/gdbtest/gcc/obj/../gcc/gcc/c/c-parser.cc:6531
0xa5067f c_parser_declaration_or_fndef
        /root/gdbtest/gcc/obj/../gcc/gcc/c/c-parser.cc:3017
0xa5af4b c_parser_external_declaration
        /root/gdbtest/gcc/obj/../gcc/gcc/c/c-parser.cc:2046
0xa5b935 c_parser_translation_unit
        /root/gdbtest/gcc/obj/../gcc/gcc/c/c-parser.cc:1900
0xa5b935 c_parse_file()
        /root/gdbtest/gcc/obj/../gcc/gcc/c/c-parser.cc:26889
0xad3a51 c_common_parse_file()
        /root/gdbtest/gcc/obj/../gcc/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.

*******************************************************************************

Also ICE on trunk, compiler explorer:https://godbolt.org/z/TYndM71e7

*******************************************************************************
  • [Bug c/115786] New: ICE: Seg... iamanonymous.cs at gmail dot com via Gcc-bugs

Reply via email to