public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Add missing check for gassign.
Date: Thu, 18 Jun 2020 09:42:31 +0200	[thread overview]
Message-ID: <333748b3-0caf-e888-812d-bdd8d2120a15@suse.cz> (raw)

Hi.

We should check for gassign before doing gimple_assign_rhs_code and friends.

Ready to be installed after proper testing?

Thanks,
Martin

gcc/ChangeLog:

	* tree-vect-generic.c (expand_vector_condition): Check
	for gassign before inspecting RHS.
---
  gcc/tree-vect-generic.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index fb955bbf3d2..83d399a7898 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -957,8 +957,9 @@ expand_vector_condition (gimple_stmt_iterator *gsi)
  
    if (code == SSA_NAME)
      {
-      gimple *assign = SSA_NAME_DEF_STMT (a);
-      if (TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison)
+      gassign *assign = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (a));
+      if (assign != NULL
+	  && TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison)
  	{
  	  a_is_comparison = true;
  	  a1 = gimple_assign_rhs1 (assign);
-- 
2.27.0


             reply	other threads:[~2020-06-18  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18  7:42 Martin Liška [this message]
2020-06-18  8:05 ` Richard Biener

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=333748b3-0caf-e888-812d-bdd8d2120a15@suse.cz \
    --to=mliska@suse.cz \
    --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).