public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] vrp: Fix ICE for pointer cap<->noncap casts
Date: Thu,  5 May 2022 12:04:49 +0000 (GMT)	[thread overview]
Message-ID: <20220505120449.C9FEA385380D@sourceware.org> (raw)

https://gcc.gnu.org/g:7b533cd785ed59adb3bdd5d49a0b3fcb43624301

commit 7b533cd785ed59adb3bdd5d49a0b3fcb43624301
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Mon Mar 14 18:10:58 2022 +0000

    vrp: Fix ICE for pointer cap<->noncap casts
    
    vrp_insert::find_assert_locations_in_bb has code to register
    assertions for operands of a statement, which we protected
    against capabilities.  However, it also has code to register
    assertions for the sources of conversions, and those need to
    be protected against capabilities too.

Diff:
---
 gcc/tree-vrp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 0a5ab8c579b..19bf6acc7ef 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -2926,8 +2926,6 @@ vrp_insert::find_assert_locations_in_bb (basic_block bb)
       /* See if we can derive an assertion for any of STMT's operands.  */
       FOR_EACH_SSA_TREE_OPERAND (op, stmt, i, SSA_OP_USE)
 	{
-	  if (capability_type_p (TREE_TYPE (op)))
-	    continue;
 	  tree value;
 	  enum tree_code comp_code;
 
@@ -2966,13 +2964,16 @@ vrp_insert::find_assert_locations_in_bb (basic_block bb)
 		      /* Note we want to register the assert for the
 			 operand of the NOP_EXPR after SI, not after the
 			 conversion.  */
-		      if (live.live_on_block_p (t, bb))
+		      if (live.live_on_block_p (t, bb)
+			  && !capability_type_p (TREE_TYPE (t)))
 			register_new_assert_for (t, t, comp_code, value,
 						 bb, NULL, si);
 		    }
 		}
 
-	      register_new_assert_for (op, op, comp_code, value, bb, NULL, si);
+	      if (!capability_type_p (TREE_TYPE (op)))
+		register_new_assert_for (op, op, comp_code, value,
+					 bb, NULL, si);
 	    }
 	}


                 reply	other threads:[~2022-05-05 12:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220505120449.C9FEA385380D@sourceware.org \
    --to=matmal01@gcc.gnu.org \
    --cc=gcc-cvs@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).