From patchwork Mon Nov 7 09:46:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 16349 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1947451wru; Mon, 7 Nov 2022 01:48:03 -0800 (PST) X-Google-Smtp-Source: AMsMyM5ZKSlLxhzhUURcFfDhDgWi5WCocBOt/EzWw8jXV69U66ESGk0ogF5rQWJuHrDYNXpGyOEV X-Received: by 2002:a17:907:2719:b0:782:b261:e9eb with SMTP id w25-20020a170907271900b00782b261e9ebmr48340854ejk.104.1667814483286; Mon, 07 Nov 2022 01:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667814483; cv=none; d=google.com; s=arc-20160816; b=fAOTbO7/UJj7NNObBxntNNrODmWn6O3EQZi33P/ZFiRTypkmOgf592/em8AKVM3rcf Y5+HUTRFqf78wRj9jjinEo8Hjl4MsGmjDKW677qhNHa9XL6Ye1QLsWZwK3imgNLAmY1P AsOy3VaQM2L61n0KymZiht8F7GGWcY5OAOYfp7jjok9yOyq0yBP788rmVvNiTvUA5wgg kowv5kEMInjHUiUDXJQKbmst+sMpdUcJHdL+rQafQfD05/Bt2Q685/8Jj8tz2zDUz50m BQWSVVHq1sHy7asy/R0ONYkcsg8TBKymhuXd5bqkcToCedQJ45ECcF2563QBG+X2pMFA v6Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=eEIiejLsqq3bJR5RSe8+h2yQSAOKDl/Z358TQwsj+CY=; b=fIIv2Xso8WGvO3IqmsVcLEMavxURwVF8DNzObUvyuPHEI1xvDdZ3ti5PVdR9ItAKg6 kVBXAixOr9dZCP+72MGytq+16EanJlOjeylVBfpop+PqSpIwVIceK846RL6BMNldpL5Z XsqtZSgKtakarRNuAEZ4uiyba9+0wtAeZ8kRXAMwVR+9BuXXjkkOUEp9EIQWPj14QJim hQbcJbSOPP64GG/KFYbpmijsY1UWkD70xBKeFZIRBrkvog3T5eYRPjiNVM1thSSyaTix raCX7b3+FOL2EVRolWRniie1D1KL0Mk1qgMh5rsNfdiTFvE0p+Ktyl83ILlDar8KYPuM oD9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GJaGqa9T; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y18-20020aa7ce92000000b0045cad599362si8175486edv.530.2022.11.07.01.48.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 01:48:03 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GJaGqa9T; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4DD153858C2C for ; Mon, 7 Nov 2022 09:48:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DD153858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667814482; bh=eEIiejLsqq3bJR5RSe8+h2yQSAOKDl/Z358TQwsj+CY=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=GJaGqa9TqF3FggF9IbWc+PVFlTqXDcP2wc9jrvgjXB+fgoTz3cLuh/ze9l3z+NLcM 6NoPi46+UTG9LqmcjLLLbPRaWLBTDFOrR9FUaxsx4ifBDEzcmFJ+I87wWxBTKm79iw 8qMlQ4WI0bwJ09dkDJXzhP4X3nehBiIl6kOrBS8c= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 352963858C1F for ; Mon, 7 Nov 2022 09:47:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 352963858C1F Received: by mail-pl1-x630.google.com with SMTP id g24so10580535plq.3 for ; Mon, 07 Nov 2022 01:47:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eEIiejLsqq3bJR5RSe8+h2yQSAOKDl/Z358TQwsj+CY=; b=D5McIZaCqhBoRC3i2xLe9kl14F/zGJOVBoqdYIgugwvIeFObn9ckF1zw3ZGq3yxZZU Qc0e4Fy2w6e4RURDMl16bRhTy8I/3NQ6HgI0z3Mxm0bJERIaVec6GtD+KeDelVUrukEu LLcPb6rbXBKJZyhr2WAnMGr22v7gHJGGxJWxckXyBpVSy5J0h5cT3rdJxT4aRg3Q9Bst 7HVHsjkbWmix6CbI3adHOw5QeFRK826vpVUfbkBXcfZz0WcCddUzvEnLi1n6I8OqUJkm 5TfyOkJEKPZmYr3HKJoPiOhklc9ZXs4hsIRDoyi6+pMeoa6PTWORAxC+QRYpq/roEiYN UQiQ== X-Gm-Message-State: ACrzQf0qbYYUoE46/Wfyd+Z8rm8tSrkOpacrNIVgfsrYD1WDLRekV/nK lHbnPBS39byhuM/n/NzeQXitbct7Yto= X-Received: by 2002:a17:902:ceca:b0:187:12cc:d6a1 with SMTP id d10-20020a170902ceca00b0018712ccd6a1mr44982224plg.162.1667814433824; Mon, 07 Nov 2022 01:47:13 -0800 (PST) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:f042:87a2:c6b:9a6f]) by smtp.gmail.com with ESMTPSA id e4-20020a170902784400b001871acf245csm4557575pln.37.2022.11.07.01.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 01:47:12 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Vladimir Makarov , Max Filippov Subject: [RFA] gcc: fix PR rtl-optimization/107482 Date: Mon, 7 Nov 2022 01:46:45 -0800 Message-Id: <20221107094645.3718427-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, GIT_PATCH_0, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Max Filippov via Gcc-patches From: Max Filippov Reply-To: Max Filippov Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748830239438417604?= X-GMAIL-MSGID: =?utf-8?q?1748830239438417604?= gcc/ * ira-color.cc (update_costs_from_allocno): Check that allocno is in the consideration_allocno_bitmap before dereferencing ALLOCNO_COLOR_DATA (allocno). --- This fixes the invalid memory access, but I'm not sure if that's sufficient and there's no remaining higher level logical issue. Regtested for target=xtensa-linux-uclibc, no new regressions. gcc/ira-color.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc index 4a1a325e8e31..4527eab39bb7 100644 --- a/gcc/ira-color.cc +++ b/gcc/ira-color.cc @@ -1434,6 +1434,8 @@ update_costs_from_allocno (ira_allocno_t allocno, int hard_regno, if (another_allocno == from || (ALLOCNO_COLOR_DATA (another_allocno) != NULL + && bitmap_bit_p (consideration_allocno_bitmap, + ALLOCNO_NUM (allocno)) && (ALLOCNO_COLOR_DATA (allocno)->first_thread_allocno != ALLOCNO_COLOR_DATA (another_allocno)->first_thread_allocno))) continue;