From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 8F2A23885524 for ; Wed, 26 Oct 2022 20:26:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F2A23885524 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666816008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h7u+YIj7xylCLGfRHM2JJYaWdRRmkgMSX8uccMp3QWw=; b=bVIDmDjcZXGWWFARD9NmKZU54X77LVWP73p8k8VTeLYBV1encXQsrl0kxtr7FN5RYDBlId A2cfuaYhMrrDzSeMfkNcFK+RUUCqKgDKn28F5UiZRdpqiY2aU4k3i691hxnypp/ywNXRjO iE1bzPWPRdRIhr0b/v6qpMy9P14sH7E= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-62-yhBAkkS5Pr-f7JrHpgXuNQ-1; Wed, 26 Oct 2022 16:26:47 -0400 X-MC-Unique: yhBAkkS5Pr-f7JrHpgXuNQ-1 Received: by mail-io1-f71.google.com with SMTP id g15-20020a6be60f000000b006bc6bc8715aso11168906ioh.12 for ; Wed, 26 Oct 2022 13:26:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=h7u+YIj7xylCLGfRHM2JJYaWdRRmkgMSX8uccMp3QWw=; b=s8aTNr2JYbhxu855+7U+kFZUUuSqdnh9s4UdUDsEQOpeNRyhFF1jYqWHuf7ZpXNw8U Kmzu9kDyPeddICIk2C9ieQzxr4bcJ/u6fFwTm/7B91gMza0tTurEB1EBrmXh4aLafj1L cbVY5sbC+5ZfCroIKFVMvrH5OE8MRzTh40UH7DfLnTbT5dYefBr75bKFUVTufUbw332U +eZTQgtMILEHZSuosHiEW/Wb554I4xKmBAqv2RjQ96iHtN37881X1x6qoUtgg4qo6tT5 3D3fgCazKEp3iXy9adedBpIcIbqloDY7d5tBY85WAAlltWkWOkTomfH0snMteq5UsW6M ziBA== X-Gm-Message-State: ACrzQf32eDlI/iYuFCEWvSDs7dQ/JAgM1YGJ5u6O3iw+va2h8ZibSD1F De4SPX3R68+VroIij4jTDrYz17cfuoVbbv1Xc1X/HMfTSN+UtXD9jGsbNKQ02TrCOk9a8UBqxdq w53aquQv7J25XDQdpWA== X-Received: by 2002:a05:6e02:1d94:b0:300:229:d9e8 with SMTP id h20-20020a056e021d9400b003000229d9e8mr8959745ila.66.1666816005162; Wed, 26 Oct 2022 13:26:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pvaNLpi9C+iXp72QEonmqAkh/NYPuTbBo3NtAhCxpp/beYb4ZINd7BnUEs4nnz8i1FHztnw== X-Received: by 2002:a05:6e02:1d94:b0:300:229:d9e8 with SMTP id h20-20020a056e021d9400b003000229d9e8mr8959716ila.66.1666816004829; Wed, 26 Oct 2022 13:26:44 -0700 (PDT) Received: from [192.168.1.113] (23-233-12-120.cpe.pppoe.ca. [23.233.12.120]) by smtp.gmail.com with ESMTPSA id g13-20020a02c54d000000b003728cd8bc7csm2334778jaj.38.2022.10.26.13.26.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Oct 2022 13:26:44 -0700 (PDT) Message-ID: <462a027f-aa10-c0bb-5b3e-a607b3b72b35@redhat.com> Date: Wed, 26 Oct 2022 16:26:43 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] IRA: Make sure array is big enough To: =?UTF-8?Q?Torbj=c3=b6rn_SVENSSON?= , gcc-patches@gcc.gnu.org Cc: yvan.roux@foss.st.com References: <20221025100103.1736564-1-torbjorn.svensson@foss.st.com> From: Vladimir Makarov In-Reply-To: <20221025100103.1736564-1-torbjorn.svensson@foss.st.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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-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 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 ();