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