This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR fortran/71799 -- Patch


Probably committable under trivially correct.  OK?

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

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

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

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

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 238665)
+++ gcc/fortran/resolve.c	(working copy)
@@ -6515,15 +6515,15 @@ gfc_resolve_iterator (gfc_iterator *iter
   /* 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: gcc/testsuite/gfortran.dg/pr71799.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr71799.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr71799.f90	(working copy)
@@ -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

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]