2 ! Tests the fix for PR25072, in which mask expressions
3 ! that start with an internal or intrinsic function
4 ! reference would give a syntax error.
6 ! The fix for PR28119 is tested as well; here, the forall
7 ! statement could not be followed by another statement on
10 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
13 integer, parameter :: n
= 4
15 pure
logical function foot (i
)
16 integer, intent(in
) :: i
17 foot
= (i
== 2) .or
. (i
== 3)
24 s
= (/(foot (i
), i
=1, n
)/)
26 ! Check that non-mask case is still OK and the fix for PR28119
28 forall (i
=1:n
) a(i
) = i
; if (any (a
.ne
. (/1,2,3,4/))) STOP 1
30 ! Now a mask using a function with an explicit interface
31 ! via use association.
33 forall (i
=1:n
, foot (i
)) a(i
) = i
34 if (any (a
.ne
. (/0,2,3,0/))) STOP 2
36 ! Now an array variable mask
38 forall (i
=1:n
, .not
. s(i
)) a(i
) = i
39 if (any (a
.ne
. (/1,0,0,4/))) STOP 3
41 ! This was the PR - an internal function mask
43 forall (i
=1:n
, t (i
)) a(i
) = i
44 if (any (a
.ne
. (/0,2,0,4/))) STOP 4
46 ! Check that an expression is OK - this also gave a syntax
49 forall (i
=1:n
, mod (i
, 2) == 0) a(i
) = i
50 if (any (a
.ne
. (/0,2,0,4/))) STOP 5
52 ! And that an expression that used to work is OK
54 forall (i
=1:n
, s (i
) .or
. t(i
)) a(i
) = w (i
)
55 if (any (a
.ne
. (/0,3,2,1/))) STOP 6
58 pure
logical function t(i
)
59 integer, intent(in
) :: i
62 pure
integer function w(i
)
63 integer, intent(in
) :: i