From: Marek Polacek Date: Wed, 15 Feb 2017 16:14:19 +0000 (+0000) Subject: re PR c/79515 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7545f1cb335004bed97202238f03e1d73832670;p=gcc.git re PR c/79515 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in do_warn_double_promotion, at c-family/c-warn.c:1867) PR c/79515 * c-warn.c (do_warn_double_promotion): Don't warn if an invalid conversion has occured. * gcc.dg/dfp/pr79515.c: New. From-SVN: r245485 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index c9fe802d7e7..6256c4d7a8a 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2017-02-15 Marek Polacek + + PR c/79515 + * c-warn.c (do_warn_double_promotion): Don't warn if an invalid + conversion has occured. + 2017-01-24 David Malcolm * c-common.c (c_common_reswords): Add "__RTL". diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index 3c9077c5e80..09c57602849 100644 --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -1864,6 +1864,9 @@ do_warn_double_promotion (tree result_type, tree type1, tree type2, warn about it. */ if (c_inhibit_evaluation_warnings) return; + /* If an invalid conversion has occured, don't warn. */ + if (result_type == error_mark_node) + return; if (TYPE_MAIN_VARIANT (result_type) != double_type_node && TYPE_MAIN_VARIANT (result_type) != complex_double_type_node) return; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fe3a304c08d..d95221a0d2c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-02-15 Marek Polacek + + PR c/79515 + * gcc.dg/dfp/pr79515.c: New. + 2017-02-15 David Edelsohn * g++.dg/cpp0x/pr79296.C: Move dg-do compile directive first. diff --git a/gcc/testsuite/gcc.dg/dfp/pr79515.c b/gcc/testsuite/gcc.dg/dfp/pr79515.c new file mode 100644 index 00000000000..6f6f09c2f48 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/pr79515.c @@ -0,0 +1,13 @@ +/* PR c/79515 */ +/* { dg-do compile } */ +/* { dg-options "-Wdouble-promotion" } */ + +extern _Decimal64 x; +extern int i; + +void +foo (void) +{ + if (x <= 2.0) /* { dg-error "mix operands" } */ + i++; +}