Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / misc-declarations.f90
blobca5f6f7ccd976ce446685b896103b34ada631ed6
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
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
6 module m
7 !ERROR: 'mustbedeferred' is an ALLOCATABLE coarray and must have a deferred coshape
8 real, allocatable :: mustBeDeferred[*] ! C827
9 !ERROR: '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 :: 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
41 end module