brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 2a4dfc4 Raw
59 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Test 15.5.2.6 constraints and restrictions for ALLOCATABLE3! dummy arguments.4 5module m6 7  real, allocatable :: cov[:], com[:,:]8 9 contains10 11  subroutine s01(x)12    real, allocatable :: x13  end subroutine14  subroutine s02(x)15    real, allocatable :: x[:]16  end subroutine17  subroutine s03(x)18    real, allocatable :: x[:,:]19  end subroutine20  subroutine s04(x)21    real, allocatable, intent(in) :: x22  end subroutine23  subroutine s05(x)24    real, allocatable, intent(out) :: x25  end subroutine26  subroutine s06(x)27    real, allocatable, intent(in out) :: x28  end subroutine29  function allofunc()30    real, allocatable :: allofunc31  end function32 33  subroutine test(x)34    real :: scalar35    real, allocatable, intent(in) :: x36    !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument37    call s01(scalar)38    !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument39    call s01(1.)40    !ERROR: ALLOCATABLE dummy argument 'x=' must be associated with an ALLOCATABLE actual argument41    call s01(allofunc()) ! subtle: ALLOCATABLE function result isn't42    call s02(cov) ! ok43    call s03(com) ! ok44    !ERROR: ALLOCATABLE or POINTER dummy argument 'x=' has corank 1 but actual argument has corank 245    call s02(com)46    !ERROR: ALLOCATABLE or POINTER dummy argument 'x=' has corank 2 but actual argument has corank 147    call s03(cov)48    call s04(cov[1]) ! ok49    !ERROR: ALLOCATABLE dummy argument 'x=' must have INTENT(IN) to be associated with a coindexed actual argument50    call s01(cov[1])51    !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' is not definable52    !BECAUSE: 'x' is an INTENT(IN) dummy argument53    call s05(x)54    !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'x=' is not definable55    !BECAUSE: 'x' is an INTENT(IN) dummy argument56    call s06(x)57  end subroutine58end module59