re PR c/79515 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark...
authorMarek Polacek <polacek@redhat.com>
Wed, 15 Feb 2017 16:14:19 +0000 (16:14 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 15 Feb 2017 16:14:19 +0000 (16:14 +0000)
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

gcc/c-family/ChangeLog
gcc/c-family/c-warn.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/dfp/pr79515.c [new file with mode: 0644]

index c9fe802d7e70a505d3e3e6a7331d4c2dd28a1989..6256c4d7a8aa0a4c1d0beb865077063d43b88488 100644 (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".
index 3c9077c5e804a602651dec78525f4883b0ea9087..09c5760284932f324fea27e251784ff99b8a5747 100644 (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;
index fe3a304c08db075cb410fc47ad19b546f821dd33..d95221a0d2c29184ab2bcb8688b2430a9de25972 100644 (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.
diff --git a/gcc/testsuite/gcc.dg/dfp/pr79515.c b/gcc/testsuite/gcc.dg/dfp/pr79515.c
new file mode 100644 (file)
index 0000000..6f6f09c
--- /dev/null
@@ -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++;
+}