https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129077
Bug ID: 129077
Summary: [15/16/17 Regression] ICE in convert_move, at
expr.cc:228 at -O3: phiopt4 turns a PHI <0, 8> of
unsigned _BitInt(200) into (T)cond << 3 after
bitintlower
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
Hi,
$cat repro.c
__attribute__((noinline)) _BitInt(200) f(unsigned x, unsigned _BitInt(200) y,
_BitInt(200) b) {
_BitInt(200) c = __builtin_parityg((unsigned _BitInt(200)) b) ?:
__builtin_ffsll(__builtin_bswap64(1));
unsigned e = b ? 0 : c;
return f(1, (unsigned _BitInt(200))(e ? __builtin_ctz(e) : 8), 0);
}
(The recursion never ends, but this is about compiling it; -c only.)
$ gcc -O3 -c repro.c
during RTL pass: expand
repro.c: In function 'f':
repro.c:4:10: internal compiler error: in convert_move, at expr.cc:228
4 | return f(1, (unsigned _BitInt(200))(e ? __builtin_ctz(e) : 8), 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x90c0ae convert_move(rtx_def*, rtx_def*, int)
../../gcc/expr.cc:228
0xf02617 convert_modes(machine_mode, machine_mode, rtx_def*, int)
../../gcc/expr.cc:967
0xef8e55 convert_to_mode(machine_mode, rtx_def*, int)
../../gcc/expr.cc:872
0xef8e55 expand_expr_real_2(separate_ops const*, rtx_def*, machine_mode,
expand_modifier)
../../gcc/expr.cc:10188
```
-O1, -O2, -Os and `-O3 -fdisable-tree-phiopt4` compile it.
Reproduced in Godbolt (gcc trunk, -O3 -c): https://godbolt.org/z/MnPz67YMr
## Checked versions
- gcc trunk 4eca40b54dd (2026-11-25, --enable-checking=yes): ICE in
convert_move, at expr.cc:228
- gcc 16.1, 16.2 (Godbolt): ICE in convert_move, at expr.cc:226; gcc 15.2
(local) and 15.3 (Godbolt): ICE in convert_move, at expr.cc:222
- gcc 14.4 (Godbolt): compiles it; gcc 16.0.1 20260315 (r16-8100, local
snapshot): compiles it
Thanks.