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 <https://gcc.gnu.org/bugs/> 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.