https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122349
Bug ID: 122349
Summary: ICE: Segmentation fault
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: qingren2hxb at gmail dot com
Target Milestone: ---
Created attachment 62586
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62586&action=edit
bug report by using -freport-bug
========================================
$g++ -v
Using built-in specs.
COLLECT_GCC=/workspace/installation/bin/g++
COLLECT_LTO_WRAPPER=/workspace/installation/libexec/gcc/x86_64-pc-linux-gnu/15.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/gcc/configure --prefix=/workspace/installation
--enable-coverage --enable-checking --disable-multilib --disable-shared
--disable-bootstrap --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.0 (GCC)
========================================
#define STRUCT_SIZE (268435456)
#include <stdlib.h>
typedef struct A {
char buf_ma[STRUCT_SIZE];
struct A *a_mp;
void (*funcA)(struct A *);
} A;
int main() {
int i;
A a1 = { "", NULL, NULL };
return 0;
}
========================================
# g++ test.C
test.C: In function 'int main()':
test.C:13:14: error: initializer-string for 'char [268435456]' is too long
[-fpermissive]
13 | A a1 = { "", NULL, NULL };
| ^~
test.C:13:29: internal compiler error: Segmentation fault
13 | A a1 = { "", NULL, NULL };
| ^
0x5d4e2e6 internal_error(char const*, ...)
/workspace/gcc/gcc/diagnostic-global-context.cc:517
0x270d8a0 crash_signal
/workspace/gcc/gcc/toplev.cc:322
0x2ead7d7 build_string(unsigned int, char const*)
/workspace/gcc/gcc/tree.cc:2570
0x1722a27 digest_init_r
/workspace/gcc/gcc/cp/typeck2.cc:1301
0x1724aa3 massage_init_elt
/workspace/gcc/gcc/cp/typeck2.cc:1573
0x17268a5 process_init_constructor_record
/workspace/gcc/gcc/cp/typeck2.cc:1816
0x1728c3e process_init_constructor
/workspace/gcc/gcc/cp/typeck2.cc:2111
0x1723b69 digest_init_r
/workspace/gcc/gcc/cp/typeck2.cc:1406
0x1723f74 digest_init_flags(tree_node*, tree_node*, int, int)
/workspace/gcc/gcc/cp/typeck2.cc:1452
0x171f521 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
/workspace/gcc/gcc/cp/typeck2.cc:858
0x10f3c9b check_initializer
/workspace/gcc/gcc/cp/decl.cc:8025
0x1101823 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int,
cp_decomp*)
/workspace/gcc/gcc/cp/decl.cc:9201
0x13f6217 cp_parser_init_declarator
/workspace/gcc/gcc/cp/parser.cc:24290
0x13d7ba7 cp_parser_simple_declaration
/workspace/gcc/gcc/cp/parser.cc:16528
0x13d731e cp_parser_block_declaration
/workspace/gcc/gcc/cp/parser.cc:16347
0x13d349b cp_parser_declaration_statement
/workspace/gcc/gcc/cp/parser.cc:15444
0x13c977c cp_parser_statement
/workspace/gcc/gcc/cp/parser.cc:13285
0x13cbd30 cp_parser_statement_seq_opt
/workspace/gcc/gcc/cp/parser.cc:13859
0x13cb541 cp_parser_compound_statement
/workspace/gcc/gcc/cp/parser.cc:13706
0x13ff27d cp_parser_function_body
/workspace/gcc/gcc/cp/parser.cc:26708
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.
After displaying the error message, g++ threw the segmentation fault.