rtlanal: Another fix for VOIDmode MEMs [PR98601]
authorJakub Jelinek <jakub@redhat.com>
Sat, 10 Apr 2021 10:46:09 +0000 (12:46 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sat, 10 Apr 2021 10:46:09 +0000 (12:46 +0200)
commit7a493fcd27d6a1af896c4f5ef4ab1e0afe8a839d
tree2addf0167454ac74f3d0c04c4205517d79a568e6
parent1c9744fb3bf2fbf7cec5722f4b187eb553d98280
rtlanal: Another fix for VOIDmode MEMs [PR98601]

This is a sequel to the PR85022 changes, inline-asm can (unfortunately)
introduce VOIDmode MEMs and in PR85022 they have been changed so that
we don't pretend we know their size (as opposed to assuming they have
zero size).

This time we ICE in rtx_addr_can_trap_p_1 because it assumes that
all memory but BLKmode has known size.  The patch just treats VOIDmode
MEMs like BLKmode in that regard.  And, the STRICT_ALIGNMENT change
is needed because VOIDmode has GET_MODE_SIZE of 0 and we don't want to
check if something is a multiple of 0.

2021-04-10  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/98601
* rtlanal.c (rtx_addr_can_trap_p_1): Allow in assert unknown size
not just for BLKmode, but also for VOIDmode.  For STRICT_ALIGNMENT
unaligned_mems handle VOIDmode like BLKmode.

* gcc.dg/torture/pr98601.c: New test.
gcc/rtlanal.c
gcc/testsuite/gcc.dg/torture/pr98601.c [new file with mode: 0644]