https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111124
Bug ID: 111124
Summary: ICE on narrowing memory-constant comparison on
loongarch
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: xen0n at gentoo dot org
CC: stefansf at linux dot ibm.com
Target Milestone: ---
Target: loongarch64-linux-gnu
Created attachment 55783
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55783&action=edit
Minimized reproducer
Bootstrap on loongarch64-linux-gnu has been failing since commit 7cdd0860949
("combine: Narrow comparison of memory and constant"), which is pinpointed by
bisection. A minimized reproducing example is attached:
$ /tmp/gcc-build/gcc/xgcc -B/tmp/gcc-build/gcc/ -O2 -S -o /dev/null
/tmp/loongarch-narrow-ice.i
during RTL pass: combine
/tmp/loongarch-narrow-ice.c: In function ‘ok_for_merging’:
/tmp/loongarch-narrow-ice.c:10:1: internal compiler error: in decompose, at
rtl.h:2297
10 | }
| ^
0x6b25af wi::int_traits<std::pair<rtx_def*, machine_mode> >::decompose(long*,
unsigned int, std::pair<rtx_def*, machine_mode> const&)
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/rtl.h:2297
0x6b25af wide_int_ref_storage<false,
true>::wide_int_ref_storage<std::pair<rtx_def*, machine_mode>
>(std::pair<rtx_def*, machine_mode> const&)
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/wide-int.h:1030
0x6b25af generic_wide_int<wide_int_ref_storage<false, true>
>::generic_wide_int<std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*,
machine_mode> const&)
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/wide-int.h:788
0x6b25af simplify_const_unary_operation(rtx_code, machine_mode, rtx_def*,
machine_mode)
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/simplify-rtx.cc:1991
0xe4d67d simplify_context::simplify_unary_operation(rtx_code, machine_mode,
rtx_def*, machine_mode)
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/simplify-rtx.cc:889
0xe4d67d simplify_context::simplify_gen_unary(rtx_code, machine_mode, rtx_def*,
machine_mode)
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/simplify-rtx.cc:360
0x168e8e9 simplify_gen_unary(rtx_code, machine_mode, rtx_def*, machine_mode)
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/rtl.h:3520
0x168e8e9 simplify_comparison
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/combine.cc:13136
0x169046f combine_simplify_rtx
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/combine.cc:6176
0x1692a35 subst
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/combine.cc:5609
0x169298d subst
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/combine.cc:5536
0x1695c78 try_combine
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/combine.cc:3339
0x169bd85 combine_instructions
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/combine.cc:1300
0x169bd85 rest_of_handle_combine
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/combine.cc:15063
0x169bd85 execute
/home/xenon/store/src/oss/own/loongson/gcc-la64/gcc/combine.cc:15107