From patchwork Tue Oct 25 10:01:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Torbjorn SVENSSON X-Patchwork-Id: 10685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp911773wru; Tue, 25 Oct 2022 03:02:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54t+wTz5rCUwEHS2BpZNxrexGe4k7QJi3dk+xPVjfePjDIljtgecqhaux2ajxzyegBKaSP X-Received: by 2002:a17:907:86a0:b0:78d:df8b:4d17 with SMTP id qa32-20020a17090786a000b0078ddf8b4d17mr31514347ejc.254.1666692141264; Tue, 25 Oct 2022 03:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666692141; cv=none; d=google.com; s=arc-20160816; b=D/Iop8YvmpJobfq77dGOU4cGT3mXc74rDAZ20xKBeKdte3SiLofO8WKlQ1Yij7Q0Gv VFRdPHAZqJ94AICNnIp7xnlOWIEkZjokFxuqRkBDS9C2yuK5IN1fS6yPrCnQR2IjQvTj r1y3mp5y+e+0ZEjtyV1al3JaNaS151nuMgtQUQpl9LThF9tdDc2uMayLvuD08j24KOB1 XY0hqcBhyUdUcVkurW4a0QuQmEAkegcFAXCN3MUN2IPxMJ9jZx53+QcHaPGLIGps99VC Ao8gJPvxMQ1VKGjj0ljsWcrJitL78V+PlrYPtMUrkAt53l7MLrfoJV8H3vCie8ypX5aj ElWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=1qDi9d6G9p+9MvZu1ZoCPI4l3t6zEW7TT/JIqljlFQk=; b=Dyo7qbUBzk7H8leiDfdATwrq1tLvqm9SXfgidds3ntYGVTu5xJpZztBhoHieSEj/Xs xv/nQpXvhqGGoBtE2mC1JeOwJAqKvwSGeZOlegeG0ELzTIX3LbaMPs/WO7VosJsPMOSm rm7H884T0CKlEpDgBdeEpTg/wYg4fAq0cer1GvOCKU6U9ordaBHASeQhEAc/GwpGoqWI ez5GnOKawbPuFPU3bOFi04KIoZ7m/EzNNdWvqpb9Vxge2O0EzY1nIXrRzovUKk03xurX J82jRMMwocT/Z/00TMjrF0lhFblZ29bG6BobatoYT+khhxWO+nJ0Sxm0oNe1Y52BOVi+ 0XxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Q6S8uwSR; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id x3-20020aa7cd83000000b00461bfb68ee2si2156718edv.196.2022.10.25.03.02.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 03:02:21 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Q6S8uwSR; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2FE863857BAB for ; Tue, 25 Oct 2022 10:02:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FE863857BAB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666692140; bh=1qDi9d6G9p+9MvZu1ZoCPI4l3t6zEW7TT/JIqljlFQk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Q6S8uwSRLfSIGs7lJghlAm+nLx8dyNp189t/UpxrYHsYqgC4bJjA25OBfVpjTLIK5 u9huc5gstC3Xhm3fmUrOdMRKb5ZYnl2rCRQvRw1ROQjyPe4pL2vCLVQjL2r8Rao1B7 u7xEeP/3I0KcQu0UEtoTc0DslYpCMHtG/pvTUBa0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id EB3BC3857C58 for ; Tue, 25 Oct 2022 10:01:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB3BC3857C58 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29P8xVAE030351; Tue, 25 Oct 2022 12:01:29 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3kc7v2h3v9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Oct 2022 12:01:29 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D969510003B; Tue, 25 Oct 2022 12:01:23 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 0CC91217B73; Tue, 25 Oct 2022 12:01:23 +0200 (CEST) Received: from jkgcxl0002.jkg.st.com (10.210.54.218) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 25 Oct 2022 12:01:22 +0200 To: Subject: [PATCH] IRA: Make sure array is big enough Date: Tue, 25 Oct 2022 12:01:04 +0200 Message-ID: <20221025100103.1736564-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.210.54.218] X-ClientProxiedBy: EQNCAS1NODE3.st.com (10.75.129.80) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-25_04,2022-10-25_01,2022-06-22_01 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , X-Patchwork-Original-From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON_via_Gcc-patches?= From: Torbjorn SVENSSON Reply-To: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747653378997109985?= X-GMAIL-MSGID: =?utf-8?q?1747653378997109985?= In commit 081c96621da, the call to resize_reg_info() was moved before the call to remove_scratches() and the latter one can increase the number of regs and that would cause an out of bounds usage on the reg_renumber global array. Without this patch, the following testcase randomly fails with: during RTL pass: ira In file included from /src/gcc/testsuite/gcc.dg/compat//struct-by-value-5b_y.c:13: /src/gcc/testsuite/gcc.dg/compat//struct-by-value-5b_y.c: In function 'checkgSf13': /src/gcc/testsuite/gcc.dg/compat//fp-struct-test-by-value-y.h:28:1: internal compiler error: Segmentation fault /src/gcc/testsuite/gcc.dg/compat//struct-by-value-5b_y.c:22:1: note: in expansion of macro 'TEST' gcc/ChangeLog: * ira.c: Resize array after reg number increased. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/ira.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/ira.cc b/gcc/ira.cc index 42c9cead9f8..d28a67b2546 100644 --- a/gcc/ira.cc +++ b/gcc/ira.cc @@ -5718,6 +5718,7 @@ ira (FILE *f) regstat_free_ri (); regstat_init_n_sets_and_refs (); regstat_compute_ri (); + resize_reg_info (); }; int max_regno_before_rm = max_reg_num ();