[Bug fortran/51589] Modification of loop index variable by intent(out) or intent(inout) procedures

w6ws at earthlink dot net gcc-bugzilla@gcc.gnu.org
Sat Dec 17 19:27:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51589

--- Comment #5 from Walter Spector <w6ws at earthlink dot net> 2011-12-17 19:04:12 UTC ---
It seems like intent information should be available when the procedures are
USE associated, as opposed to the internal procedures.  However gfortran does
not diagnose that case either.  Here is an expanded test case:

module intent_mod
  implicit none

contains

  subroutine submod1 (idx)
    integer, intent(inout) :: idx

    idx = 42

  end subroutine

  subroutine submod2 (idx)
    integer, intent(out) :: idx

    idx = 11

  end subroutine

end module

program intents
  use intent_mod
  implicit none

  integer :: i

  do, i=1,10
    call sub1 (i)
    print *, i
    call sub2 (i)
    print *, i
    call submod1 (i)
    print *, i
    call submod2 (i)
    print *, i
  end do

contains

  subroutine sub1 (idx)
    integer, intent(inout) :: idx

    idx = 42

  end subroutine

  subroutine sub2 (idx)
    integer, intent(out) :: idx

    idx = 11

  end subroutine

end program



More information about the Gcc-bugs mailing list