From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7897) id 68A75382EA11; Thu, 27 Oct 2022 07:39:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68A75382EA11 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666856394; bh=fNx6Ko7CeYp6qsI2X1TT4+FFSwwbpHzgpE4zQ7EKYfQ=; h=From:To:Subject:Date:From; b=u2eFCVWFELhth+aQAYKSRSXYwn8n7wWt1l/7ic7GS1uzQNiq99VHjUMN/+PmPRfBJ wTQxVqN3VSjssX0qMk+Bpu2xYZFvLoSRTngU791Fera4oGx8OfwoFi5D41Xr4et0uE mmczTO0GzEIC++yLFbnjUkXA3980eQbTh9KXsSD8= 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 r11-10341] 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-11 X-Git-Oldrev: a49ad13d56935767370a700bbd1bec868daff5c3 X-Git-Newrev: 48e5d0f2eca05391fbb99e5b4ec79405d496f8c1 Message-Id: <20221027073954.68A75382EA11@sourceware.org> Date: Thu, 27 Oct 2022 07:39:54 +0000 (GMT) List-Id: https://gcc.gnu.org/g:48e5d0f2eca05391fbb99e5b4ec79405d496f8c1 commit r11-10341-g48e5d0f2eca05391fbb99e5b4ec79405d496f8c1 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.c: 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.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/ira.c b/gcc/ira.c index b93588d8a9f..ad40506d2a9 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5613,6 +5613,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 ();