public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Cc: Richard Sandiford <richard.sandiford@arm.com>
Subject: [PATCH 1/4] rtl-ssa: Fix null deref in first_any_insn_use
Date: Tue, 24 Oct 2023 11:29:57 +0100	[thread overview]
Message-ID: <20231024103000.3334790-2-richard.sandiford@arm.com> (raw)
In-Reply-To: <20231024103000.3334790-1-richard.sandiford@arm.com>

first_any_insn_use implicitly (but contrary to its documentation)
assumed that there was at least one use.

gcc/
	* rtl-ssa/member-fns.inl (first_any_insn_use): Handle null
	m_first_use.
---
 gcc/rtl-ssa/member-fns.inl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/rtl-ssa/member-fns.inl b/gcc/rtl-ssa/member-fns.inl
index c127fab8b98..3fdca14e0ef 100644
--- a/gcc/rtl-ssa/member-fns.inl
+++ b/gcc/rtl-ssa/member-fns.inl
@@ -215,7 +215,7 @@ set_info::last_nondebug_insn_use () const
 inline use_info *
 set_info::first_any_insn_use () const
 {
-  if (m_first_use->is_in_any_insn ())
+  if (m_first_use && m_first_use->is_in_any_insn ())
     return m_first_use;
   return nullptr;
 }
-- 
2.25.1


  reply	other threads:[~2023-10-24 10:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 10:29 [PATCH 0/4] rtl-ssa: Some small, obvious fixes Richard Sandiford
2023-10-24 10:29 ` Richard Sandiford [this message]
2023-10-24 10:29 ` [PATCH 2/4] rtl-ssa: Fix handling of deleted insns Richard Sandiford
2023-10-24 10:29 ` [PATCH 3/4] rtl-ssa: Don't insert after insns that can throw Richard Sandiford
2023-10-24 10:30 ` [PATCH 4/4] rtl-ssa: Avoid creating duplicated phis Richard Sandiford

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=20231024103000.3334790-2-richard.sandiford@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).