public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Vladimir Makarov <vmakarov@redhat.com>,
	Max Filippov <jcmvbkbc@gmail.com>
Subject: [RFA] gcc: fix PR rtl-optimization/107482
Date: Mon,  7 Nov 2022 01:46:45 -0800	[thread overview]
Message-ID: <20221107094645.3718427-1-jcmvbkbc@gmail.com> (raw)

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;
-- 
2.30.2


             reply	other threads:[~2022-11-07  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07  9:46 Max Filippov [this message]
2022-11-07 20:52 ` Vladimir Makarov
2022-11-08 10:05   ` Max Filippov

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=20221107094645.3718427-1-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=vmakarov@redhat.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).