diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-12-09 09:15:36 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-12-09 09:15:36 +0000 |
commit | da52ef437636927aa2bb33d50417a1e1c6a8dee2 (patch) | |
tree | 590f48a25ac157170a8183ddf10ba931cee92030 /gcc | |
parent | 5f515aaecb0097a0afbef336815934cfa0d698d8 (diff) | |
download | gcc-da52ef437636927aa2bb33d50417a1e1c6a8dee2.zip gcc-da52ef437636927aa2bb33d50417a1e1c6a8dee2.tar.gz gcc-da52ef437636927aa2bb33d50417a1e1c6a8dee2.tar.bz2 |
re PR fortran/55593 (Bogus error on passing DO LOOP variable)
2012-12-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/55593
* frontend-passes.c (doloop_code): Use resolved_sym
instead of n.sym->formal for formal argument list
to get the correct version for all generic subroutines.
2012-12-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/55593
* gfortran.dg/do_check_8.f90: New test.
From-SVN: r194329
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/frontend-passes.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/do_check_8.f90 | 59 |
4 files changed, 74 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 344c4e4..12d53ee 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2012-12-09 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/55593 + * gfortran.dg/do_check_8.f90: New test. + 2012-12-05 Tobias Burnus <burnus@net-b.de> * resolve.c (generate_component_assignments): Fix memleak. diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 6679368..691862f 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -1277,7 +1277,11 @@ doloop_code (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED, break; case EXEC_CALL: - f = co->symtree->n.sym->formal; + + if (co->resolved_sym == NULL) + break; + + f = co->resolved_sym->formal; /* Withot a formal arglist, there is only unknown INTENT, which we don't check for. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b1f6c99..823916a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-12-09 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/55593 + * gfortran.dg/do_check_8.f90: New test. + 2012-12-08 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/vect10.ad[sb]: New test. diff --git a/gcc/testsuite/gfortran.dg/do_check_8.f90 b/gcc/testsuite/gfortran.dg/do_check_8.f90 new file mode 100644 index 0000000..458ae40 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_check_8.f90 @@ -0,0 +1,59 @@ +! { dg-do compile } +! PR 55593 - bogus error with generic subroutines +module foo + implicit none + interface sub + subroutine sub2(i) + integer, intent(in) :: i + end subroutine sub2 + subroutine sub(i) + integer, dimension(:), intent(out) :: i + end subroutine sub + end interface sub + + interface tub2 + subroutine tub2(i) + integer, intent(in) :: i + end subroutine tub2 + subroutine tub(i) + integer, dimension(:), intent(out) :: i + end subroutine tub + end interface tub2 + + interface func + integer function ifunc(i) + integer, intent(in) :: i + end function ifunc + integer function func(i) + integer, intent(in) :: i(:) + end function func + end interface func + + interface igunc + integer function igunc(i) + integer, intent(in) :: i + end function igunc + integer function gunc(i) + integer, intent(in) :: i(:) + end function gunc + end interface igunc +end module foo + +program main + use foo + implicit none + integer :: i + do i=1,10 + call sub(i) + call tub2(i) + end do + do i=1,10 + print *,func(i) + print *,igunc(i) + end do + + do undeclared=1,10 ! { dg-error "has no IMPLICIT type" } + call sub(undeclared) + end do +end program main +! { dg-final { cleanup-modules "foo" } } |