1! RUN: %S/test_errors.sh %s %t %f18
2! Miscellaneous constraint and requirement checking on declarations:
3! - 8.5.6.2 & 8.5.6.3 constraints on coarrays
4! - 8.5.19 constraints on the VOLATILE attribute
5
6module m
7  !ERROR: 'mustbedeferred' is an ALLOCATABLE coarray and must have a deferred coshape
8  real, allocatable :: mustBeDeferred[*]  ! C827
9  !ERROR: Component 'mustbeexplicit' is a non-ALLOCATABLE coarray and must have an explicit coshape
10  real :: mustBeExplicit[:]  ! C828
11  type :: hasCoarray
12    real, allocatable :: coarray[:]
13  end type
14  real :: coarray[*]
15  type(hasCoarray) :: coarrayComponent
16 contains
17  !ERROR: VOLATILE attribute may not apply to an INTENT(IN) argument
18  subroutine C866(x)
19    intent(in) :: x
20    volatile :: x
21    !ERROR: VOLATILE attribute may apply only to a variable
22    volatile :: notData
23    external :: notData
24  end subroutine
25  subroutine C867
26    !ERROR: VOLATILE attribute may not apply to a coarray accessed by USE or host association
27    volatile :: coarray
28    !ERROR: VOLATILE attribute may not apply to a type with a coarray ultimate component accessed by USE or host association
29    volatile :: coarrayComponent
30  end subroutine
31  subroutine C868(coarray,coarrayComponent)
32    real, volatile :: coarray[*]
33    type(hasCoarray) :: coarrayComponent
34    block
35      !ERROR: VOLATILE attribute may not apply to a coarray accessed by USE or host association
36      volatile :: coarray
37      !ERROR: VOLATILE attribute may not apply to a type with a coarray ultimate component accessed by USE or host association
38      volatile :: coarrayComponent
39    end block
40  end subroutine
41end module
42