public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] middle-end/107994 - ICE after error with comparison gimplification
@ 2022-12-21 12:12 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-12-21 12:12 UTC (permalink / raw)
  To: gcc-patches

The following avoids passing down error_mark_node to fold_convert.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	PR middle-end/107994
	* gimplify.cc (gimplify_expr): Catch errorneous comparison
	operand.
---
 gcc/gimplify.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 250782b1140..c9c800a5850 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -17098,6 +17098,9 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
 		 Compare scalar mode aggregates as scalar mode values.  Using
 		 memcmp for them would be very inefficient at best, and is
 		 plain wrong if bitfields are involved.  */
+	      if (error_operand_p (TREE_OPERAND (*expr_p, 1)))
+		ret = GS_ERROR;
+	      else
 		{
 		  tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 1));
 
@@ -17122,9 +17125,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
 		    ret = gimplify_scalar_mode_aggregate_compare (expr_p);
 		  else
 		    ret = gimplify_variable_sized_compare (expr_p);
-
-		  break;
 		}
+	      break;
 
 	    /* If *EXPR_P does not need to be special-cased, handle it
 	       according to its class.  */
-- 
2.35.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-21 12:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-21 12:12 [PATCH] middle-end/107994 - ICE after error with comparison gimplification Richard Biener

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).