]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/107994 - ICE after error with comparison gimplification
authorRichard Biener <rguenther@suse.de>
Wed, 21 Dec 2022 11:27:58 +0000 (12:27 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 24 Jan 2023 13:36:04 +0000 (14:36 +0100)
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)

gcc/gimplify.cc

index 2588824dce25b3c5bbcf97ba30625ea26152044f..a3aa90262c52e5e7f9343a42babcc4d325293c18 100644 (file)
@@ -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.  */