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