xref: /llvm-project/flang/test/Semantics/call14.f90 (revision c1c9929028004a717d8dea3cdf416260ef97bea8)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2! Test 8.5.18 constraints on the VALUE attribute
3
4module m
5  type :: hasCoarray
6    real, allocatable :: coarray[:]
7  end type
8 contains
9  !ERROR: VALUE attribute may apply only to a dummy data object
10  subroutine C863(notData,assumedSize,coarray,coarrayComponent,assumedRank,assumedLen)
11    external :: notData
12    !WARNING: Only a dummy argument should have an INTENT, VALUE, or OPTIONAL attribute
13    real, value :: notADummy
14    value :: notData
15    !ERROR: VALUE attribute may not apply to an assumed-size array
16    real, value :: assumedSize(10,*)
17    !ERROR: VALUE attribute may not apply to a coarray
18    real, value :: coarray[*]
19    !ERROR: VALUE attribute may not apply to a type with a coarray ultimate component
20    type(hasCoarray), value :: coarrayComponent
21    !ERROR: VALUE attribute may not apply to an assumed-rank array
22    real, value :: assumedRank(..)
23    !PORTABILITY: VALUE attribute on assumed-length CHARACTER may not be portable
24    character(*), value :: assumedLen
25  end subroutine
26  subroutine C864(allocatable, inout, out, pointer, volatile)
27    !ERROR: VALUE attribute may not apply to an ALLOCATABLE
28    real, value, allocatable :: allocatable
29    !ERROR: VALUE attribute may not apply to an INTENT(IN OUT) argument
30    real, value, intent(in out) :: inout
31    !ERROR: VALUE attribute may not apply to an INTENT(OUT) argument
32    real, value, intent(out) :: out
33    !ERROR: VALUE attribute may not apply to a POINTER
34    real, value, pointer :: pointer
35    !ERROR: VALUE attribute may not apply to a VOLATILE
36    real, value, volatile :: volatile
37  end subroutine
38  subroutine C865(optional) bind(c)
39    !ERROR: VALUE attribute may not apply to an OPTIONAL in a BIND(C) procedure
40    real, value, optional :: optional
41  end subroutine
42end module
43