diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/convert.cc | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/float16-8.c | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/gcc/convert.cc b/gcc/convert.cc index 64b7001..5357609 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: { diff --git a/gcc/testsuite/gcc.target/i386/float16-8.c b/gcc/testsuite/gcc.target/i386/float16-8.c new file mode 100644 index 0000000..003f82e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/float16-8.c @@ -0,0 +1,12 @@ +/* { 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 "" } */ +} |