convert_to_complex when creating a COMPLEX_EXPR does
not currently check if either the real or imag parts
was not error_mark_node. This later on confuses the gimpilfier
when there was a SAVE_EXPR wrapped around that COMPLEX_EXPR.
The simple fix is after calling convert inside convert_to_complex_1,
check that the either result was an error_operand and return
an error_mark_node in that case.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR c/111903
gcc/ChangeLog:
* convert.cc (convert_to_complex_1): Return
error_mark_node if either convert was an error
when converting from a scalar.
gcc/testsuite/ChangeLog:
* gcc.target/i386/float16-8.c: New test.
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:
{
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mno-sse" } */
+/* PR c/111903 */
+
+int i;
+_Float16 f;
+int bar(...);
+void
+foo (void)
+{
+ i /= bar ((_Complex _Float16) f); /* { dg-error "" } */
+}