From 20d68fa0d816a1aa77ead82317d3bdae77490edf Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Sun, 13 Dec 2020 20:46:16 +0000 Subject: [PATCH] VAX: Fix lower bound adjustment with `casesi' Fix an issue with the `casesi' expander using `GEN_INT' to produce the constant rtx for lower bound adjustment. This generates a VOIDmode value which may overflow the SImode range required for the operand to stay within to satisfy `general_operand', resulting in an ICE like: .../gcc/testsuite/gcc.c-torture/compile/pr46934.c: In function 'caller': .../gcc/testsuite/gcc.c-torture/compile/pr46934.c:17:1: error: unrecognizable insn: (insn 5 2 6 2 (set (reg:SI 25) (plus:SI (mem/c:SI (reg/f:SI 17 virtual-incoming-args) [1 reg_type+0 S4 A32]) (const_int 2147483648 [0x80000000]))) -1 (nil)) during RTL pass: vregs .../gcc/testsuite/gcc.c-torture/compile/pr46934.c:17:1: internal compiler error: in extract_insn, at recog.c:2315 0x110d4673 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*) .../gcc/rtl-error.c:108 0x110d46eb _fatal_insn_not_found(rtx_def const*, char const*, int, char const*) .../gcc/rtl-error.c:116 0x1106578b extract_insn(rtx_insn*) .../gcc/recog.c:2315 0x10b63f73 instantiate_virtual_regs_in_insn .../gcc/function.c:1609 0x10b65b2f instantiate_virtual_regs .../gcc/function.c:1979 0x10b65ca7 execute .../gcc/function.c:2028 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. compiler exited with status 1 FAIL: gcc.c-torture/compile/pr46934.c -O0 (internal compiler error) Use `gen_int_mode' to produce the rtx instead, requesting a SImode value so that the constant gets correctly truncated: @@ -199,7 +199,7 @@ caller (unsigned int reg_type) (insn 5 4 6 (set (reg:SI 25) (plus:SI (mem/c:SI (reg/f:SI 17 virtual-incoming-args) [1 reg_type+0 S4 A32]) - (const_int 2147483648 [0x80000000]))) -1 + (const_int -2147483648 [0xffffffff80000000]))) -1 (nil)) (jump_insn 6 5 7 (set (pc) removing these test suite failures: FAIL: gcc.c-torture/compile/pr46934.c -O0 (internal compiler error) FAIL: gcc.c-torture/compile/pr46934.c -O0 (test for excess errors) with the `vax-netbsdelf' target. gcc/ * config/vax/vax.md (casesi): Use `gen_int_mode' rather than `GEN_INT' for the immediate used for lower bound adjustment. --- gcc/config/vax/vax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md index b8cf4eed4bc..ecde0cdfd92 100644 --- a/gcc/config/vax/vax.md +++ b/gcc/config/vax/vax.md @@ -2816,7 +2816,7 @@ rtx index = gen_reg_rtx (SImode); emit_insn (gen_addsi3 (index, operands[0], - GEN_INT (-INTVAL (operands[1])))); + gen_int_mode (-INTVAL (operands[1]), SImode))); operands[0] = index; } -- 2.30.2