From c851722d5a57f31e85883014fccc81b3d61c85a7 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Thu, 28 Jul 2016 19:04:12 +0000 Subject: [PATCH] re PR fortran/71799 (ICE in DO loop code emission (gfc_resolve_iterator)) 2016-07-28 Steven G. Kargl PR fortran/71799 * resolve.c(gfc_resolve_iterator): Failure of type conversion need not ICE. 2016-07-28 Steven G. Kargl PR fortran/71799 * gfortran.dg/pr71799.f90: New test. From-SVN: r238830 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/resolve.c | 6 +++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr71799.f90 | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr71799.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a5c29686014..752fb02d4b0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-07-28 Steven G. Kargl + + PR fortran/71799 + * resolve.c(gfc_resolve_iterator): Failure of type conversion need + not ICE. + 2016-07-28 Steven G. Kargl PR fortran/71859 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 1fc540a1f0e..23da9ac4444 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1bfcdeb40eb..fc764c97e97 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-28 Steven G. Kargl + + PR fortran/71799 + * gfortran.dg/pr71799.f90: New test. + 2016-07-28 Paolo Carlini PR c++/71665 diff --git a/gcc/testsuite/gfortran.dg/pr71799.f90 b/gcc/testsuite/gfortran.dg/pr71799.f90 new file mode 100644 index 00000000000..32be5f766d3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71799.f90 @@ -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 -- 2.30.2