https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111260
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Zdenek Sojka from comment #2)
> Different testcase:
> $ cat testcase.c
> long
> bar (long x)
> {
> x *= x == 0 / 0;
> return (x);
> }
>
> long
> foo (void)
> {
> return bar (822920);
> }
>
> $ aarch64-unknown-linux-gnu-gcc -O testcase.c
> testcase.c: In function 'bar':
> testcase.c:4:15: warning: division by zero [-Wdiv-by-zero]
> 4 | x *= x == 0 / 0;
> | ^
> during RTL pass: expand
> testcase.c: In function 'foo':
> testcase.c:11:10: internal compiler error: in maybe_legitimize_operand, at
> optabs.cc:8046
> 11 | return bar (822920);
> | ^~~~~~~~~~~~
> 0x7ff794 maybe_legitimize_operand
> /repo/gcc-trunk/gcc/optabs.cc:8046
> 0x7ff794 maybe_legitimize_operands(insn_code, unsigned int, unsigned int,
> expand_operand*)
> /repo/gcc-trunk/gcc/optabs.cc:8194
> ...
That is 100% a different bug and should be filed separately.