OSDN Git Service

2012-08-27 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 27 Aug 2012 12:03:41 +0000 (12:03 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 27 Aug 2012 12:03:41 +0000 (12:03 +0000)
        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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190709 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 4d50517..eff252c 100644 (file)
@@ -1,5 +1,11 @@
 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.
        * invoke.texi (-Wall, -Wcompare-reals): -Wall no longer
        implies -Wcompare-reals.
index 9467601..8bc4916 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 1c7f779..fd5b350 100644 (file)
@@ -1,5 +1,10 @@
 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
        from dg-options as -Wall no longer implies it.
 
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