public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Torbjorn SVENSSON <torbjorn.svensson@foss.st.com>
To: Vladimir Makarov <vmakarov@redhat.com>, <gcc-patches@gcc.gnu.org>
Cc: <yvan.roux@foss.st.com>
Subject: Re: [PATCH] IRA: Make sure array is big enough
Date: Thu, 27 Oct 2022 09:42:46 +0200	[thread overview]
Message-ID: <bb3274bf-6417-7b67-c674-8669ca4bd7e7@foss.st.com> (raw)
In-Reply-To: <462a027f-aa10-c0bb-5b3e-a607b3b72b35@redhat.com>



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 <yvan.roux@foss.st.com>
>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
>> ---
>>   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 ();
> 

      reply	other threads:[~2022-10-27  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25 10:01 Torbjörn SVENSSON
2022-10-26 20:26 ` Vladimir Makarov
2022-10-27  7:42   ` Torbjorn SVENSSON [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb3274bf-6417-7b67-c674-8669ca4bd7e7@foss.st.com \
    --to=torbjorn.svensson@foss.st.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=vmakarov@redhat.com \
    --cc=yvan.roux@foss.st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).