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
This commit is contained in:
Marek Polacek 2017-02-15 16:14:19 +00:00 committed by Marek Polacek
parent 1114b39cdf
commit c7545f1cb3
4 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2017-02-15 Marek Polacek <polacek@redhat.com>
PR c/79515
* c-warn.c (do_warn_double_promotion): Don't warn if an invalid
conversion has occured.
2017-01-24 David Malcolm <dmalcolm@redhat.com>
* c-common.c (c_common_reswords): Add "__RTL".

View File

@ -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;

View File

@ -1,3 +1,8 @@
2017-02-15 Marek Polacek <polacek@redhat.com>
PR c/79515
* gcc.dg/dfp/pr79515.c: New.
2017-02-15 David Edelsohn <dje.gcc@gmail.com>
* g++.dg/cpp0x/pr79296.C: Move dg-do compile directive first.

View File

@ -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++;
}