https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117083
Bug ID: 117083
Summary: ICE: in get_expr_operands, at tree-ssa-operands.cc:939
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 an internal error during
operands_scanner::get_expr_operands 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-241009/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-241009
--enable-languages=c,c++ --disable-multilib --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241009 (experimental) (GCC)
*******************************************************************************
Program:
# cat bugreport_0_1.c
void foo (unsigned *);
void bar (const unsigned char *block)
{
unsigned buf[4];
__builtin_memcpy (buf + 0, block + 0, 4);
__builtin_memcpy (buf + 1, block + 4, 4);
__builtin_memcpy (buf + 2, block + 8, 4);
__builtin_memcpy (buf + 3, block + 12, 4);
foo (buf);
}
void __GIMPLE (ssa,guessed_local(1073741824))
bar (const unsigned char * block)
{
vector(4) unsigned int vect__3.5;
unsigned int buf[4];
__BB(2,guessed_local(1073741824)):
vect__3.5_14 = __MEM <vector(4) unsigned int, 8> ((char *
{ref-all})block_2(D));
__MEM <vector(4) unsigned int> ((char * {ref-all})&buf) = vect__3.5_14;
foo (&buf);
buf ={v} _Literal (unsigned int[4]) {CLOBBER(eol)};
return;
}
*******************************************************************************
Command Lines:
# gcc bugreport_0_1.c -O3 -fno-omit-frame-pointer -fstrict-overflow
-frename-registers -fno-delete-null-pointer-checks
bugreport_0_1.c:12:6: error: ‘__GIMPLE’ only valid with ‘-fgimple’
12 | void __GIMPLE (ssa,guessed_local(1073741824))
| ^~~~~~~~
bugreport_0_1.c:13:1: error: redefinition of ‘bar’
13 | bar (const unsigned char * block)
| ^~~
bugreport_0_1.c:2:6: note: previous definition of ‘bar’ with type ‘void(const
unsigned char *)’
2 | void bar (const unsigned char *block)
| ^~~
bugreport_0_1.c: In function ‘bar’:
bugreport_0_1.c:15:3: error: implicit declaration of function ‘vector’
[-Wimplicit-function-declaration]
15 | vector(4) unsigned int vect__3.5;
| ^~~~~~
bugreport_0_1.c:15:13: error: expected ‘=’ before ‘unsigned’
15 | vector(4) unsigned int vect__3.5;
| ^~~~~~~~
bugreport_0_1.c:16:3: error: expected expression before ‘unsigned’
16 | unsigned int buf[4];
| ^~~~~~~~
bugreport_0_1.c:19:10: error: invalid suffix "_14" on floating constant
19 | vect__3.5_14 = __MEM <vector(4) unsigned int, 8> ((char *
{ref-all})block_2(D));
| ^~~~~
bugreport_0_1.c:19:10: error: base variable or SSA name undeclared before
numeric constant
bugreport_0_1.c:20:10: error: expected specifier-qualifier-list before ‘vector’
20 | __MEM <vector(4) unsigned int> ((char * {ref-all})&buf) =
vect__3.5_14;
| ^~~~~~
bugreport_0_1.c:20:42: error: expected ‘)’ before ‘{’ token
20 | __MEM <vector(4) unsigned int> ((char * {ref-all})&buf) =
vect__3.5_14;
| ^~
| )
bugreport_0_1.c:20:54: error: ‘buf’ undeclared (first use in this function)
20 | __MEM <vector(4) unsigned int> ((char * {ref-all})&buf) =
vect__3.5_14;
| ^~~
bugreport_0_1.c:20:54: note: each undeclared identifier is reported only once
for each function it appears in
bugreport_0_1.c:20:68: error: invalid suffix "_14" on floating constant
20 | __MEM <vector(4) unsigned int> ((char * {ref-all})&buf) =
vect__3.5_14;
|
^~~~~
bugreport_0_1.c:20:68: error: base variable or SSA name undeclared before
numeric constant
bugreport_0_1.c:22:8: error: expected expression before ‘{’ token
22 | buf ={v} _Literal (unsigned int[4]) {CLOBBER(eol)};
| ^
unhandled expression in get_expr_operands():
<error_mark 0x7fc120e60f30>
bugreport_0_1.c:24:1: internal compiler error: in get_expr_operands, at
tree-ssa-operands.cc:939
24 | }
| ^
0x260066e internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:517
0x9dc7a1 fancy_abort(char const*, int, char const*)
../../gcc/gcc/diagnostic.cc:1617
0x12fc701 operands_scanner::get_expr_operands(tree_node**, int)
../../gcc/gcc/tree-ssa-operands.cc:939
0x12fcbb0 operands_scanner::parse_ssa_operands()
../../gcc/gcc/tree-ssa-operands.cc:989
0x12fd9bb operands_scanner::build_ssa_operands()
../../gcc/gcc/tree-ssa-operands.cc:1004
0x12fdaa3 update_stmt_operands(function*, gimple*)
../../gcc/gcc/tree-ssa-operands.cc:1146
0xd69507 update_stmt_if_modified(gimple*)
../../gcc/gcc/gimple-ssa.h:187
0xd69507 update_stmt_if_modified(gimple*)
../../gcc/gcc/gimple-ssa.h:184
0xd69507 update_modified_stmts(gimple*)
../../gcc/gcc/gimple-iterator.cc:59
0xd69619 gsi_insert_seq_after(gimple_stmt_iterator*, gimple*,
gsi_iterator_update)
../../gcc/gcc/gimple-iterator.cc:333
0xa9d7f1 c_parser_gimple_compound_statement
../../gcc/gcc/c/gimple-parser.cc:685
0xa9f9b8 c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
../../gcc/gcc/c/gimple-parser.cc:253
0xa8a5d2 c_parser_declaration_or_fndef
../../gcc/gcc/c/c-parser.cc:3026
0xa95117 c_parser_external_declaration
../../gcc/gcc/c/c-parser.cc:2060
0xa95bbd c_parser_translation_unit
../../gcc/gcc/c/c-parser.cc:1914
0xa95bbd c_parse_file()
../../gcc/gcc/c/c-parser.cc:27348
0xb11cf1 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.cc:1349
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/8drjKeKWq
*******************************************************************************