https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80725
Bug ID: 80725
Summary: s390x ICE on alsa-lib
Product: gcc
Version: 7.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
The following testcase reduced from alsa-lib ICEs on s390x with -O2
-march=zEC12:
int a, e;
const char b;
char c;
const int d;
void bar (short);
void
foo (int x, int y)
{
long f = d;
short g = 0;
while (e)
while (a < x)
{
if (y)
goto *d;
g = b | b + g;
bar (g);
c = (char) (long) foo;
}
}
The problem is in indirect jump, which is fine before LRA:
(jump_insn 13 12 14 3 (set (pc)
(reg/v:DI 66 [ f ])) "rh1450353.c":16 1922 {*indirect_jump}
(expr_list:REG_DEAD (reg/v:DI 66 [ f ])
(nil)))
but starting with *.reload it is:
(jump_insn 13 12 14 3 (set (pc)
(reg/v:DI 24 %f8 [orig:66 f ] [66])) "rh1450353.c":16 1922
{*indirect_jump}
(nil))
which for some strange reason happily satisfies the ZR constraint, as neither
s390_decompose_address, nor s390_check_qrst_address nor s390_mem_constraint
performs any verification of the hard registers in there (it is fine if it
accepts pseudos, but for hard registers it would be nice if it checked
what s390_legitimate_address_p checks.