1! RUN: %S/test_errors.sh %s %t %f18 2! Test 15.5.2.6 constraints and restrictions for ALLOCATABLE 3! dummy arguments. 4 5module m 6 7 real, allocatable :: cov[:], com[:,:] 8 9 contains 10 11 subroutine s01(x) 12 real, allocatable :: x 13 end subroutine 14 subroutine s02(x) 15 real, allocatable :: x[:] 16 end subroutine 17 subroutine s03(x) 18 real, allocatable :: x[:,:] 19 end subroutine 20 subroutine s04(x) 21 real, allocatable, intent(in) :: x 22 end subroutine 23 subroutine s05(x) 24 real, allocatable, intent(out) :: x 25 end subroutine 26 subroutine s06(x) 27 real, allocatable, intent(in out) :: x 28 end subroutine 29 function allofunc() 30 real, allocatable :: allofunc 31 end function 32 33 subroutine test(x) 34 real :: scalar 35 real, allocatable, intent(in) :: x 36 !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument 37 call s01(scalar) 38 !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument 39 call s01(1.) 40 !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument 41 call s01(allofunc()) ! subtle: ALLOCATABLE function result isn't 42 call s02(cov) ! ok 43 call s03(com) ! ok 44 !ERROR: ALLOCATABLE dummy argument 'x=' has corank 1 but actual argument has corank 2 45 call s02(com) 46 !ERROR: ALLOCATABLE dummy argument 'x=' has corank 2 but actual argument has corank 1 47 call s03(cov) 48 call s04(cov[1]) ! ok 49 !ERROR: ALLOCATABLE dummy argument 'x=' must have INTENT(IN) to be associated with a coindexed actual argument 50 call s01(cov[1]) 51 !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' must be definable 52 call s05(x) 53 !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' must be definable 54 call s06(x) 55 end subroutine 56end module 57