From patchwork Thu Dec 10 11:20:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1414007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux-mips.org Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsBLD0vqGz9sWC for ; Thu, 10 Dec 2020 22:20:50 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3CF493857804; Thu, 10 Dec 2020 11:20:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by sourceware.org (Postfix) with ESMTP id 63BA03857804 for ; Thu, 10 Dec 2020 11:20:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 63BA03857804 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-mips.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=macro@linux-mips.org Received: from localhost.localdomain ([127.0.0.1]:40134 "EHLO localhost" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23990474AbgLJLUYInAwK (ORCPT ); Thu, 10 Dec 2020 12:20:24 +0100 Date: Thu, 10 Dec 2020 11:20:24 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org Subject: [PATCH] VAX: Fix lower bound adjustment with `casesi' Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" 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(-) Index: gcc/gcc/config/vax/vax.md =================================================================== --- gcc.orig/gcc/config/vax/vax.md +++ gcc/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; }