]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/54370 (error: non-trivial conversion in unary operation)
authorTobias Burnus <burnus@net-b.de>
Thu, 6 Jun 2013 16:45:04 +0000 (18:45 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Thu, 6 Jun 2013 16:45:04 +0000 (18:45 +0200)
2013-06-06  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline
        2012-08-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54370
        * trans-stmt.c (gfc_trans_do_while): Don't change the logical
        kind for negation of the condition.

2013-06-06  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline
        2012-08-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54370
        * gfortran.dg/do_5.f90: New.

From-SVN: r199746

gcc/fortran/ChangeLog
gcc/fortran/trans-stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/do_5.f90 [new file with mode: 0644]

index 7f6fa7a3e7cfcc82f30dc364b257fc96dd4c5779..f76ec6bf284ca0e3f509c1c8fafb6964631f88e8 100644 (file)
@@ -1,3 +1,12 @@
+2013-06-06  Tobias Burnus  <burnus@net-b.de>
+
+       Backport from mainline
+       2012-08-27  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/54370
+       * trans-stmt.c (gfc_trans_do_while): Don't change the logical
+       kind for negation of the condition.
+
 2013-06-01  Janus Weil  <janus@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>
 
index 630816ed401504797203a7a76b93868edc2ac27c..b8914f3dc43a0a248dbc6d0e20fbaafceb7c53a5 100644 (file)
@@ -1743,7 +1743,7 @@ gfc_trans_do_while (gfc_code * code)
   gfc_conv_expr_val (&cond, code->expr1);
   gfc_add_block_to_block (&block, &cond.pre);
   cond.expr = fold_build1_loc (code->expr1->where.lb->location,
-                              TRUTH_NOT_EXPR, boolean_type_node, cond.expr);
+                              TRUTH_NOT_EXPR, TREE_TYPE (cond.expr), cond.expr);
 
   /* Build "IF (! cond) GOTO exit_label".  */
   tmp = build1_v (GOTO_EXPR, exit_label);
index d156c635db7545397f165bdfb9e42a35b2f98dfc..f80afa0ad46c6864fed1203da223c39bd52e83bc 100644 (file)
@@ -1,3 +1,11 @@
+2013-06-06  Tobias Burnus  <burnus@net-b.de>
+
+       Backport from mainline
+       2012-08-27  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/54370
+       * gfortran.dg/do_5.f90: New.
+
 2013-06-01  Janus Weil  <janus@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>
 
diff --git a/gcc/testsuite/gfortran.dg/do_5.f90 b/gcc/testsuite/gfortran.dg/do_5.f90
new file mode 100644 (file)
index 0000000..107a35a
--- /dev/null
@@ -0,0 +1,29 @@
+! { dg-do compile }
+!
+! PR fortran/54370
+!
+! The following program was ICEing at tree-check time
+! "L()" was regarded as default-kind logical.
+!
+! Contributed by Kirill Chilikin
+!
+      MODULE M
+      CONTAINS
+
+      LOGICAL(C_BOOL) FUNCTION L() BIND(C)
+      USE, INTRINSIC :: ISO_C_BINDING
+      L = .FALSE.
+      END FUNCTION
+
+      LOGICAL(8) FUNCTION L2() BIND(C) ! { dg-warning "may not be a C interoperable kind but it is bind" }
+      L2 = .FALSE._8
+      END FUNCTION
+
+      SUBROUTINE S()
+      DO WHILE (L())
+      ENDDO
+      DO WHILE (L2())
+      ENDDO
+      END
+
+      END