6 integer, protected
:: i
14 ! Valid: data-implied-do (has a scope of the statement or construct)
15 DATA (A(i
), i
=1,5)/5*42/ ! OK
17 ! Valid: ac-implied-do (has a scope of the statement or construct)
18 print *, [(i
, i
=1,5 )] ! OK
20 ! Valid: index-name (has a scope of the statement or construct)
24 ! Valid: index-name (has a scope of the statement or construct)
25 do concurrent (i
= 1:5) ! OK
28 ! Invalid: io-implied-do
29 print *, (i
, i
=1,5 ) ! { dg-error "PROTECTED and can not appear in a variable definition context .iterator variable." }
31 ! Invalid: do-variable in a do-stmt
32 do i
= 1, 5 ! { dg-error "PROTECTED and can not appear in a variable definition context .iterator variable." }
38 integer, intent(in
) :: i
40 ! Valid: data-implied-do (has a scope of the statement or construct)
41 DATA (A(i
), i
=1,5)/5*42/ ! OK
43 ! Valid: ac-implied-do (has a scope of the statement or construct)
44 print *, [(i
, i
=1,5 )] ! OK
46 ! Valid: index-name (has a scope of the statement or construct)
50 ! Valid: index-name (has a scope of the statement or construct)
51 do concurrent (i
= 1:5) ! OK
54 ! Invalid: io-implied-do
55 print *, (i
, i
=1,5 ) ! { dg-error "INTENT.IN. in variable definition context .iterator variable." }
57 ! Invalid: do-variable in a do-stmt
58 do i
= 1, 5 ! { dg-error "INTENT.IN. in variable definition context .iterator variable." }
62 pure
subroutine test3()
66 !DATA (A(j), j=1,5)/5*42/ ! Not allowed in pure
68 ! Valid: ac-implied-do (has a scope of the statement or construct)
69 A
= [(j
, j
=1,5 )] ! OK
71 ! Valid: index-name (has a scope of the statement or construct)
75 ! Valid: index-name (has a scope of the statement or construct)
76 do concurrent (j
= 1:5) ! OK
79 ! print *, (j, j=1,5 ) ! I/O not allowed in PURE
81 ! Invalid: do-variable in a do-stmt
82 do j
= 1, 5 ! { dg-error "variable definition context .iterator variable. at .1. in PURE procedure" }