[gcc r12-9063] middle-end/107994 - ICE after error with comparison gimplification

Richard Biener rguenth@gcc.gnu.org
Tue Jan 24 14:27:23 GMT 2023


https://gcc.gnu.org/g:45cff68d063b689bd6a9f30827b1fdd3f5ea2cb4

commit r12-9063-g45cff68d063b689bd6a9f30827b1fdd3f5ea2cb4
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Dec 21 12:27:58 2022 +0100

    middle-end/107994 - ICE after error with comparison gimplification
    
    The following avoids passing down error_mark_node to fold_convert.
    
            PR middle-end/107994
            * gimplify.cc (gimplify_expr): Catch errorneous comparison
            operand.
    
    (cherry picked from commit 845b514e8a150447ba041294586af76a6ac05158)

Diff:
---
 gcc/gimplify.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 2588824dce2..a3aa90262c5 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -15832,6 +15832,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));
 
@@ -15856,9 +15859,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.  */


More information about the Gcc-cvs mailing list