https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116353
Bug ID: 116353
Summary: [15 Regression] ICE on glibc-2.39: RTL pass: ce2, in
expand_simple_binop, at optabs.cc:1264
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
Might be a dupe of https://gcc.gnu.org/PR116349. Filing just in case it's not
as it's a slightly different RTL pass with a similar backtrace.
On r15-2896-g0451bc503da9c8 minimized example looks this way:
// $ cat a.c
enum desmode { C };
struct {
unsigned char des_ivec[];
} _des_crypt_desp;
int des_SPtrans_6_0, des_SPtrans_4_0, des_encrypt_encrypt, des_encrypt_i;
long des_encrypt_s_0, _des_crypt_tin1, _des_crypt_tout0, _des_crypt_tout1,
_des_crypt_tin0;
enum desmode _des_crypt_desp_0;
unsigned long _des_crypt_tbuf[2];
char _des_crypt_out;
void des_encrypt(unsigned long *buf) {
long l, r, t;
l = buf[0];
r = buf[1];
t = r;
r ^= l ^= t < 6;
if (des_encrypt_encrypt)
for (;; des_encrypt_i += 4)
des_encrypt_s_0 ^= des_SPtrans_4_0 | des_SPtrans_6_0;
buf[1] = r;
}
void _des_crypt() {
long xor0, xor1;
unsigned char *in;
int cbc_mode = _des_crypt_desp_0;
in = _des_crypt_desp.des_ivec;
xor0 = xor1 = 0;
for (;;) {
_des_crypt_tin0 = *in++;
_des_crypt_tin0 |= *in++ << 8;
_des_crypt_tin0 |= *in++ << 16;
_des_crypt_tin0 |= (long)*in << 24;
_des_crypt_tin1 = *in++;
_des_crypt_tin1 |= *in++ << 8;
_des_crypt_tin1 |= *in++ << 16;
_des_crypt_tin1 |= (long)*in << 24;
_des_crypt_tbuf[0] = _des_crypt_tin0;
_des_crypt_tbuf[1] = _des_crypt_tin1;
des_encrypt(_des_crypt_tbuf);
if (cbc_mode) {
_des_crypt_tout0 = xor0;
_des_crypt_tout1 = _des_crypt_tbuf[1] ^ xor1;
xor0 = _des_crypt_tin0;
xor1 = _des_crypt_tin1;
} else {
_des_crypt_tout0 = _des_crypt_tbuf[0];
_des_crypt_tout1 = _des_crypt_tbuf[1];
}
_des_crypt_out = _des_crypt_tout0 * _des_crypt_tout1;
}
}
Crashing:
$ gcc/xgcc -Bgcc -O2 -c a.c
during RTL pass: ce2
a.c: In function ‘_des_crypt’:
a.c:51:1: internal compiler error: in expand_simple_binop, at optabs.cc:1264
51 | }
| ^
0x24054fb diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1],
diagnostic_t)
???:0
0x2413237 internal_error(char const*, ...)
???:0
0x240337a fancy_abort(char const*, int, char const*)
???:0
0xdce6a6 expand_simple_binop(machine_mode, rtx_code, rtx_def*, rtx_def*,
rtx_def*, int, optab_methods)
???:0
0xacb67e force_operand(rtx_def*, rtx_def*)
???:0
0xa98677 copy_to_mode_reg(machine_mode, rtx_def*)
???:0
0xdc6cab maybe_legitimize_operands(insn_code, unsigned int, unsigned int,
expand_operand*)
???:0
0xdc6db6 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
???:0
0xdc7041 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
???:0
0xdc715a emit_conditional_move_1(rtx_def*, rtx_def*, rtx_def*, rtx_def*,
machine_mode)
???:0
0xdc754e emit_conditional_move(rtx_def*, rtx_comparison, rtx_def*, rtx_def*,
machine_mode, int)
???:0
0x224e23d noce_emit_cmove(noce_if_info*, rtx_def*, rtx_code, rtx_def*,
rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*)
???:0
0x224eb3e try_emit_cmove_seq(noce_if_info*, rtx_def*, rtx_def*, rtx_def*,
rtx_def*, bool, unsigned int*, rtx_def**, rtx_def*, rtx_def*)
???:0
0x225162b noce_convert_multiple_sets_1(noce_if_info*,
auto_delete_vec<noce_multiple_sets_info>&, int*)
???:0
0x2255a56 noce_convert_multiple_sets(noce_if_info*)
???:0
0x2257309 if_convert(bool)
???:0
0x22590d7 (anonymous namespace)::pass_if_after_combine::execute(function*)
???:0
Info:
$ gcc/xgcc -Bgcc -v
Reading specs from gcc/specs
COLLECT_GCC=gcc/xgcc
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap --disable-lto --disable-libsanitizer --enable-languages=c
CFLAGS='-O1 -g0' CXXFLAGS='-O1 -g0' LDFLAGS='-O1 -g0' : (reconfigured)
/home/slyfox/dev/git/gcc/configure --disable-multilib --disable-bootstrap
--disable-lto --disable-libsanitizer --enable-languages=c CFLAGS='-O1 -g0'
CXXFLAGS='-O1 -g0' LDFLAGS='-O1 -g0'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240812 (experimental) (GCC)