From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7897) id E46B9385416D; Thu, 27 Oct 2022 07:41:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E46B9385416D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666856517; bh=dgT+XKim1Ag6oK9hPHXNr6PWnHais7IEAsyglpddsgs=; h=From:To:Subject:Date:From; b=bZZLHx6sMqCDkovdDcv5sFXAS8OQHz6fDih22Gx/X+cS7Vyjrb/YNVNloi5+XYMU5 HiqO57guHLVtCCNiFh/gECiUeakEeBJJa658J6h5IqdrAGvz4L2I4d/zjMH+lSPyx1 HX3of10a147O1VTYZvYl0rhEeCwZZrcTwEg1sSX4= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Torbjorn Svensson To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8871] IRA: Make sure array is big enough X-Act-Checkin: gcc X-Git-Author: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: e089e35af1e62634f98deddbceb2d20e92af0245 X-Git-Newrev: 72717ec3ab66ba04e16ea84bd092f987a415672e Message-Id: <20221027074157.E46B9385416D@sourceware.org> Date: Thu, 27 Oct 2022 07:41:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:72717ec3ab66ba04e16ea84bd092f987a415672e commit r12-8871-g72717ec3ab66ba04e16ea84bd092f987a415672e Author: Torbjörn SVENSSON Date: Tue Oct 25 11:45:40 2022 +0200 IRA: Make sure array is big enough 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.cc: Resize array after reg number increased. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON (cherry picked from commit 4e1d704243a4f3c4ded47cd0d02427bb7efef069) Diff: --- gcc/ira.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/ira.cc b/gcc/ira.cc index e3b3c549120..a287026a275 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 ();