https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120329
--- Comment #3 from Dimitar Dimitrov <dimitar at gcc dot gnu.org> ---
Alternative way to reproduce the issue is to apply the attached
validate_subreg_hardening.patch to increase the checks for subregs.
When the snippet from the description is built, it results in ICE:
during RTL pass: combine
/home/dinux/tmp/c120/test.c: In function ‘test’:
/home/dinux/tmp/c120/test.c:9:1: internal compiler error: in gen_rtx_SUBREG, at
emit-rtl.cc:1042
9 | }
| ^
0x21006df internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:517
0x83dbe9 fancy_abort(char const*, int, char const*)
../../gcc/gcc/diagnostic.cc:1815
0x480b6e gen_rtx_SUBREG(machine_mode, rtx_def*, poly_int<1u, unsigned long>)
../../gcc/gcc/emit-rtl.cc:1042
0x480b6e gen_rtx_SUBREG(machine_mode, rtx_def*, poly_int<1u, unsigned long>)
../../gcc/gcc/emit-rtl.cc:1040
0x1dfe31b expand_compound_operation
../../gcc/gcc/combine.cc:7411
0x1e0f837 subst
../../gcc/gcc/combine.cc:5659
0x1e0f696 subst
../../gcc/gcc/combine.cc:5586
0x1e13b8b try_combine
../../gcc/gcc/combine.cc:3319
0x1e1b4e1 combine_instructions
../../gcc/gcc/combine.cc:1271
0x1e1b4e1 rest_of_handle_combine
../../gcc/gcc/combine.cc:15214
0x1e1b4e1 execute
../../gcc/gcc/combine.cc:15258