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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This fixes the issue:
diff --git a/gcc/convert.cc b/gcc/convert.cc
index 64b7001843c..5357609d8f0 100644
--- a/gcc/convert.cc
+++ b/gcc/convert.cc
@@ -1006,8 +1006,13 @@ convert_to_complex_1 (tree type, tree expr, bool fold_p)
     case ENUMERAL_TYPE:
     case BOOLEAN_TYPE:
     case BITINT_TYPE:
-      return build2 (COMPLEX_EXPR, type, convert (subtype, expr),
-                    convert (subtype, integer_zero_node));
+      {
+       tree real = convert (subtype, expr);
+       tree imag = convert (subtype, integer_zero_node);
+       if (error_operand_p (real) || error_operand_p (imag))
+         return error_mark_node;
+       return build2 (COMPLEX_EXPR, type, real, imag);
+      }

     case COMPLEX_TYPE:
       {

Reply via email to