From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 8E356385AC35 for ; Thu, 27 Oct 2022 07:42:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8E356385AC35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29R4N0gQ025690; Thu, 27 Oct 2022 09:42:54 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=IPMSZPvmkBlgEG9gDn1p/m4MsqxAeQ2jiTMHaCg3bw4=; b=u2X+ltbYdtueZl7s6sIIDhM2NbEu23NzZkLN7bYkbxygb7N4we+y5cuRskFC4a6mA6AH 7ZDgx6yHtSj8CGbq1OroOsfSvYYPX5PJxT5FhWItdxuwh6yMBAi2htc569NO7CYSQOyp wdcdBVLQPApqSd/EarukhLpiyqQC10Amy+xhhY10bb2HoGaD9Udi7qwVQ6EhHalmz0ry gRM6kB9xoCURiaGxuaOQPRqy8Q+vPcfUgFWqPRIF5tnpqqSBXgPtMDV2fvMADPsqlUiT 9ojizo+d+aKN+QnEu4NHSlHgNXqJVCELzxqkK6YxFnMD9Qg8i+Kxae7pKlYjJ16fDpqj aw== 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 3kfagc3rg7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Oct 2022 09:42:54 +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 B2A96100038; Thu, 27 Oct 2022 09:42:48 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 91463210F94; Thu, 27 Oct 2022 09:42:48 +0200 (CEST) Received: from [10.210.55.83] (10.210.55.83) 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; Thu, 27 Oct 2022 09:42:47 +0200 Message-ID: Date: Thu, 27 Oct 2022 09:42:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH] IRA: Make sure array is big enough Content-Language: en-US To: Vladimir Makarov , CC: References: <20221025100103.1736564-1-torbjorn.svensson@foss.st.com> <462a027f-aa10-c0bb-5b3e-a607b3b72b35@redhat.com> From: Torbjorn SVENSSON In-Reply-To: <462a027f-aa10-c0bb-5b3e-a607b3b72b35@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.210.55.83] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) 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-27_03,2022-10-26_01,2022-06-22_01 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,NICE_REPLY_A,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 List-Id: On 2022-10-26 22:26, Vladimir Makarov wrote: > > On 2022-10-25 06:01, Torbjörn SVENSSON wrote: >> 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. > > The patch is ok to commit it into gcc-11,12 branches and master. Thank you for the review! Pushed to gcc-11, gcc-12 and master. > > Thank you for fixing this. > >> 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 (); >