re PR fortran/71799 (ICE in DO loop code emission (gfc_resolve_iterator))
authorSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 28 Jul 2016 19:04:12 +0000 (19:04 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 28 Jul 2016 19:04:12 +0000 (19:04 +0000)
2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/71799
* resolve.c(gfc_resolve_iterator): Failure of type conversion need
not ICE.

2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/71799
* gfortran.dg/pr71799.f90: New test.

From-SVN: r238830

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr71799.f90 [new file with mode: 0644]

index a5c29686014742dbf11c8bbcfbae511c0820cf3d..752fb02d4b00675a3bf1af14cf0e5e76949b2b63 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/71799
+       * resolve.c(gfc_resolve_iterator): Failure of type conversion need
+       not ICE.
+
 2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/71859
index 1fc540a1f0ece59b330ff929310ca4f0ee3d1d36..23da9ac444443391e7b1e64e440a4ba4d2d7bfbf 100644 (file)
@@ -6515,15 +6515,15 @@ gfc_resolve_iterator (gfc_iterator *iter, bool real_ok, bool own_scope)
   /* Convert start, end, and step to the same type as var.  */
   if (iter->start->ts.kind != iter->var->ts.kind
       || iter->start->ts.type != iter->var->ts.type)
-    gfc_convert_type (iter->start, &iter->var->ts, 2);
+    gfc_convert_type (iter->start, &iter->var->ts, 1);
 
   if (iter->end->ts.kind != iter->var->ts.kind
       || iter->end->ts.type != iter->var->ts.type)
-    gfc_convert_type (iter->end, &iter->var->ts, 2);
+    gfc_convert_type (iter->end, &iter->var->ts, 1);
 
   if (iter->step->ts.kind != iter->var->ts.kind
       || iter->step->ts.type != iter->var->ts.type)
-    gfc_convert_type (iter->step, &iter->var->ts, 2);
+    gfc_convert_type (iter->step, &iter->var->ts, 1);
 
   if (iter->start->expr_type == EXPR_CONSTANT
       && iter->end->expr_type == EXPR_CONSTANT
index 1bfcdeb40ebd61a4d48737ae0d2e1725027edf2d..fc764c97e974ae671befbf9bd69355e50f2ef1a6 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/71799
+       * gfortran.dg/pr71799.f90: New test.
+
 2016-07-28  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/71665
diff --git a/gcc/testsuite/gfortran.dg/pr71799.f90 b/gcc/testsuite/gfortran.dg/pr71799.f90
new file mode 100644 (file)
index 0000000..32be5f7
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+subroutine test2(s)
+integer(1) :: i
+integer (8) :: s
+
+do i = 10, HUGE(i) - 10, 222 ! { dg-error "overflow converting" }
+  s = s + 1
+end do
+
+end subroutine test2