1 ! RUN: %python %S/test_errors.py %s %flang_fc1
4 !ERROR: 'i' is already declared in this scoping unit
5 !ERROR: Cannot redefine FORALL variable 'i'
6 forall (i
=1:8, i
=1:9) a(i
) = i
7 !ERROR: 'i' is already declared in this scoping unit
8 !ERROR: Cannot redefine FORALL variable 'i'
13 !ERROR: 'j' is already declared in this scoping unit
14 !ERROR: Cannot redefine FORALL variable 'j'
21 integer, pointer :: a(:)
22 integer, target
:: b(10,10)
24 !ERROR: Impure procedure 'f_impure' may not be referenced in a FORALL
25 a(f_impure(i
):) => b(i
,:)
27 !ERROR: FORALL mask expression may not reference impure procedure 'f_impure'
28 forall (j
=1:10, f_impure(1)>2)
31 impure
integer function f_impure(i
)
39 !ERROR: Cannot redefine FORALL variable 'i'
44 !ERROR: Cannot redefine FORALL variable 'i'
45 !WARNING: FORALL index variable 'j' not used on left-hand side of assignment
49 !ERROR: Cannot redefine FORALL variable 'i'
54 integer, parameter :: zero
= 0
57 !ERROR: FORALL limit expression may not reference index variable 'i'
61 !ERROR: FORALL step expression may not reference index variable 'i'
65 !ERROR: FORALL step expression may not be zero
70 !ERROR: FORALL limit expression may not reference index variable 'i'
71 forall(i
=1:i
) a(i
) = i
72 !ERROR: FORALL step expression may not reference index variable 'i'
73 forall(i
=1:10:i
) a(i
) = i
74 !ERROR: FORALL step expression may not be zero
75 forall(i
=1:10:zero
) a(i
) = i
78 ! Note: this gets warnings but not errors
80 real, target
:: x(10), y(10)
85 !WARNING: FORALL index variable 'i' not used on left-hand side of assignment
88 !WARNING: FORALL index variable 'j' not used on left-hand side of assignment
90 !WARNING: FORALL index variable 'i' not used on left-hand side of assignment
96 !WARNING: FORALL index variable 'i' not used on left-hand side of assignment
106 real, target
:: b(10)
109 !WARNING: FORALL index variable 'i' not used on left-hand side of assignment
114 subroutine forall7(x
)
118 associate (j
=> iarr(1))
123 associate (j
=> iarr(1) + 1)