https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115623
Bug ID: 115623
Summary: ICE: Segmentation fault ( in contains_struct_check
and finish_for_cond for cpp)
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 contains_struct_check 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
*******************************************************************************
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
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 1.c
void f (char *a, int i)
{
#pragma GCC novector
for (;;i++)
a[i] *= 2;
}
*******************************************************************************
Command Lines:
# g++ 1.c -O3 -Wpedantic -Wall -Wextra -Wconversion -Wshadow -Wunused
-Woverloaded-virtual -Wpedantic -Wsign-conversion -Wmisleading-indentation
-Wduplicated-cond -Wnull-dereference -Wdouble-promotion -c -o 1.o
1.c: In function ‘void f(char*, int)’:
1.c:4:8: internal compiler error: Segmentation fault
4 | for (;;i++)
| ^
0x13a93af crash_signal
/root/gdbtest/gcc/obj/../gcc/gcc/toplev.cc:319
0xd22180 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
/root/gdbtest/gcc/obj/../gcc/gcc/tree.h:3769
0xd22180 finish_for_cond(tree_node*, tree_node*, bool, tree_node*, bool)
/root/gdbtest/gcc/obj/../gcc/gcc/cp/semantics.cc:1506
0xc840c4 cp_parser_c_for
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:14088
0xc840c4 cp_parser_for
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:14056
0xc840c4 cp_parser_iteration_statement
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:14690
0xc50ec5 cp_parser_pragma
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:51340
0xc84977 cp_parser_statement
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:12843
0xc59807 cp_parser_statement_seq_opt
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13427
0xc59a2f cp_parser_compound_statement
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13281
0xc7ccd5 cp_parser_function_body
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26072
0xc7ccd5 cp_parser_ctor_initializer_opt_and_function_body
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26123
0xc8241e cp_parser_function_definition_after_declarator
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:32903
0xc835be cp_parser_function_definition_from_specifiers_and_declarator
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:32820
0xc835be cp_parser_init_declarator
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:23451
0xc5668f cp_parser_simple_declaration
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15958
0xc8ffea cp_parser_declaration
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15631
0xc90fea cp_parser_toplevel_declaration
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15652
0xc90fea cp_parser_translation_unit
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:5284
0xc90fea c_parse_file()
/root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:51440
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/zY8bvPj3T
*******************************************************************************