]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/54370 (error: non-trivial conversion in unary operation)
authorTobias Burnus <burnus@net-b.de>
Mon, 27 Aug 2012 12:03:41 +0000 (14:03 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Mon, 27 Aug 2012 12:03:41 +0000 (14:03 +0200)
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.

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

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

From-SVN: r190709

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

index 4d50517ce972b27b349d1e05d879d758427fdcfa..eff252cb465db53d94f8d89916efb1408cb77f28 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2012-08-27  Tobias Burnus  <burnus@net-b.de>
 
        * options.c (set_Wall): Don't set for -Wcompare-reals.
index 9467601c08df59a5711164310acac3aad3d122b6..8bc491655becfb7a765c5377aa4c19299552b1e2 100644 (file)
@@ -1785,7 +1785,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 1c7f779a7857eb02b50c2c512e6e7a13d8327c74..fd5b3504baeaaeb3da4e4e807763b6a0fb4ef05d 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-27  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/54370
+       * gfortran.dg/do_5.f90: New.
+
 2012-08-27  Tobias Burnus  <burnus@net-b.de>
 
        * gfortran.dg/bessel_5.f90: Remove -Wno-compare-reals
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..08cd8e6
--- /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)
+      L2 = .FALSE._8
+      END FUNCTION
+
+      SUBROUTINE S()
+      DO WHILE (L())
+      ENDDO
+      DO WHILE (L2())
+      ENDDO
+      END
+
+      END