simplify-rtx: Fix VOIDmode operand handling in simplify_subreg [PR108805]
commit6ac3ebed5ffbac0d81c5a1d0cb1e345cfad202a8
authorUros Bizjak <ubizjak@gmail.com>
Fri, 17 Feb 2023 14:58:12 +0000 (17 15:58 +0100)
committerUros Bizjak <ubizjak@gmail.com>
Fri, 17 Feb 2023 15:04:26 +0000 (17 16:04 +0100)
tree28465a1ced31e6a5ed45f120c7752d2779c7128f
parent593c8b73fb15683fdd1a9d85fe7e7e99540de3c8
simplify-rtx: Fix VOIDmode operand handling in simplify_subreg [PR108805]

simplify_subreg can return VOIDmode const_int operand and will
cause ICE in simplify_gen_subreg when this operand is passed to it.

The patch uses int_outermode instead of GET_MODE of temporary as the
innermode argument of simplify_gen_subreg.

2023-02-17  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

PR target/108805
* simplify-rtx.cc (simplify_context::simplify_subreg): Use
int_outermode instead of GET_MODE (tem) to prevent
VOIDmode from entering simplify_gen_subreg.

gcc/testsuite/ChangeLog:

PR target/108805
* gcc.dg/pr108805.c: New test.
gcc/simplify-rtx.cc
gcc/testsuite/gcc.dg/pr108805.c [new file with mode: 0644]