https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125972
Bug ID: 125972
Summary: [16/17 Regression] s390: Deal with non-compare
conditions during RTX costing
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: target
Assignee: stefansf at gcc dot gnu.org
Reporter: stefansf at gcc dot gnu.org
Target Milestone: ---
Target: s390*-*-*
int a, b, c;
long d, e;
int *f;
__int128 g;
void h() {
g = 0;
for (; g <= 33; ++g) {
int *i = &c;
*i = d - a;
if (*i) {
c = 0;
for (; c <= 8; ++c)
f = &b;
} else
++e;
}
}
$ gcc t.c -march=z16 -O3 -S
during RTL pass: cprop
t.c: In function 'h':
t.c:17:1: internal compiler error: RTL check: expected elt 0 type 'e' or 'u',
have 'w' (rtx const_int) in s390_rtx_costs, at config/s390/s390.cc:3995
17 | }
| ^
0x47ce929 internal_error(char const*, ...)
/devel/gcc/src/gcc/diagnostic-global-context.cc:787
0x28a2f4f rtl_check_failed_type2(rtx_def const*, int, int, int, char const*,
int, char const*)
/devel/gcc/src/gcc/rtl.cc:761
0x3122c79 s390_rtx_costs
/devel/gcc/src/gcc/config/s390/s390.cc:3995
0x28cb0ff rtx_cost(rtx_def*, machine_mode, rtx_code, int, bool)
/devel/gcc/src/gcc/rtlanal.cc:4623
0x25211af set_rtx_cost(rtx_def*, bool)
/devel/gcc/src/gcc/rtl.h:2974
0x4269bf3 try_replace_reg
/devel/gcc/src/gcc/cprop.cc:761
0x426b47f constprop_register
/devel/gcc/src/gcc/cprop.cc:1025
0x426be09 do_local_cprop
/devel/gcc/src/gcc/cprop.cc:1213
0x426c38d local_cprop_pass
/devel/gcc/src/gcc/cprop.cc:1276
0x426e465 one_cprop_pass
/devel/gcc/src/gcc/cprop.cc:1793
0x426ed6b execute_rtl_cprop
/devel/gcc/src/gcc/cprop.cc:1952
0x426ef09 execute
/devel/gcc/src/gcc/cprop.cc:1992
/devel/gcc/build/gcc/cc1 -quiet -iprefix
/devel/gcc/build/gcc/../lib/gcc/s390x-ibm-linux-gnu/17.0.0/ -isystem
/devel/gcc/build/gcc/include -isystem /devel/gcc/build/gcc/include-fixed t.c
-quiet -dumpbase t.c -dumpbase-ext .c -march=z16 -m64 -mzarch -O3 -o t.s
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.
Needs proper handling of intermediate RTXs with non-compare conditions during
RTX costing.
Already testing a fix; just need a PR number for backport tracking.