1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Tests for the last sentence of C1128:
3 !A variable-name that is not permitted to appear in a variable definition
4 !context shall not appear in a LOCAL or LOCAL_INIT locality-spec.
7 real, intent(in
) :: arg
9 ! This is not OK because "arg" is "intent(in)"
10 !ERROR: INTENT IN argument 'arg' not allowed in a locality-spec
11 do concurrent (i
=1:5) local(arg
)
16 real, value
, intent(in
) :: arg
18 ! This is not OK even though "arg" has the "value" attribute. C1128
19 ! explicitly excludes dummy arguments of INTENT(IN)
20 !ERROR: INTENT IN argument 'arg' not allowed in a locality-spec
21 do concurrent (i
=1:5) local(arg
)
26 real, protected
:: prot
31 ! C857 This is OK because of the "protected" attribute only applies to
32 ! accesses outside the module
33 do concurrent (i
=1:5) local(prot
)
41 ! C857 This is not OK because of the "protected" attribute
42 !ERROR: 'prot' may not appear in a locality-spec because it is not definable
43 !BECAUSE: 'prot' is protected in this scope
44 do concurrent (i
=1:5) local(prot
)
47 ! C857 This is OK because of there's no "protected" attribute
48 do concurrent (i
=1:5) local(var
)
55 associate (a
=> b
+ c
, d
=> e
)
57 ! C1101 This is OK because 'd' is associated with a variable
58 do concurrent (i
=1:5) local(d
)
61 ! C1101 This is not OK because 'a' is not associated with a variable
62 !ERROR: 'a' may not appear in a locality-spec because it is not definable
63 !BECAUSE: 'a' is construct associated with an expression
64 do concurrent (i
=1:5) local(a
)
74 type, extends(point
) :: color_point
78 type(point
), target
:: c
, d
79 class(point
), pointer :: p_or_c
82 select
type ( a
=> p_or_c
)
84 ! C1158 This is OK because 'a' is associated with a variable
85 do concurrent (i
=1:5) local(a
)
89 select
type ( a
=> func() )
91 ! C1158 This is OK because 'a' is associated with a variable
92 do concurrent (i
=1:5) local(a
)
96 select
type ( a
=> (func()) )
98 ! C1158 This is not OK because 'a' is not associated with a variable
99 !ERROR: 'a' may not appear in a locality-spec because it is not definable
100 !BECAUSE: 'a' is construct associated with an expression
101 do concurrent (i
=1:5) local(a
)
107 class(point
), pointer :: func
113 real, protected
:: prot
120 ! C1594 This is not OK because we're in a PURE subroutine
121 !ERROR: 'var' may not appear in a locality-spec because it is not definable
122 !BECAUSE: 'var' may not be defined in pure subprogram 's7' because it is USE-associated
123 do concurrent (i
=1:5) local(var
)
128 integer, parameter :: iconst
= 343
130 !ERROR: 'iconst' may not appear in a locality-spec because it is not definable
131 !BECAUSE: 'iconst' is not a variable
132 do concurrent (i
=1:5) local(iconst
)