1! RUN: %S/test_errors.sh %s %t %f18
2! Test 15.5.2.8 coarray dummy arguments
3
4module m
5
6  real :: c1[*]
7  real, volatile :: c2[*]
8
9 contains
10
11  subroutine s01(x)
12    real :: x[*]
13  end subroutine
14  subroutine s02(x)
15    real, volatile :: x[*]
16  end subroutine
17  subroutine s03(x)
18    real, contiguous :: x(:)[*]
19  end subroutine
20  subroutine s04(x)
21    real :: x(*)[*]
22  end subroutine
23
24  subroutine test(x,c3,c4)
25    real :: scalar
26    real :: x(:)[*]
27    real, intent(in) :: c3(:)[*]
28    real, contiguous, intent(in) :: c4(:)[*]
29    call s01(c1) ! ok
30    call s02(c2) ! ok
31    call s03(c4) ! ok
32    call s04(c4) ! ok
33    !ERROR: Actual argument associated with coarray dummy argument 'x=' must be a coarray
34    call s01(scalar)
35    !ERROR: VOLATILE coarray may not be associated with non-VOLATILE coarray dummy argument 'x='
36    call s01(c2)
37    !ERROR: non-VOLATILE coarray may not be associated with VOLATILE coarray dummy argument 'x='
38    call s02(c1)
39    !ERROR: Actual argument associated with a CONTIGUOUS coarray dummy argument 'x=' must be simply contiguous
40    call s03(c3)
41    !ERROR: Actual argument associated with a CONTIGUOUS coarray dummy argument 'x=' must be simply contiguous
42    call s03(x)
43    !ERROR: Actual argument associated with coarray dummy argument 'x=' (not assumed shape or rank) must be simply contiguous
44    call s04(c3)
45    !ERROR: Actual argument associated with coarray dummy argument 'x=' (not assumed shape or rank) must be simply contiguous
46    call s04(x)
47  end subroutine
48end module
49