[Bug middle-end/107307] [12/13 Regression] ICE tree check: expected class 'type', have 'exceptional' (error_mark) in canonicalize_component_ref, at gimplify.cc:2923 since r12-3278-g823685221de986af

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 17 20:24:40 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107307

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simple fix:
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index f06ce3cc77a..bd772c15bec 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -3319,7 +3319,9 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p,
gimple_seq *post_p,
     }

   /* If the outermost expression is a COMPONENT_REF, canonicalize its type. 
*/
-  if ((fallback & fb_rvalue) && TREE_CODE (*expr_p) == COMPONENT_REF)
+  if (ret != GS_ERROR
+      && (fallback & fb_rvalue)
+      && TREE_CODE (*expr_p) == COMPONENT_REF)
     {
       canonicalize_component_ref (expr_p);
     }


I am going to submit this and PR 106764 together.


More information about the Gcc-bugs mailing list