2 ! { dg-options "-std=legacy" }
4 ! Tests the fix for the second bit of PR29389, in which the
5 ! statement function would not be recognised as not PURE
6 ! when it referenced a procedure that is not PURE.
8 ! This is based on stfunc_4.f90 with the statement function made
9 ! impure by a reference to 'v'.
11 ! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
13 INTEGER :: st1
, i
= 99, a(4), q
= 6
16 FORALL(i
=1:4) a(i
) = st1 (i
)
17 FORALL(i
=1:4) a(i
) = u (a(i
)) - a(i
)** 2
18 if (any (a
.ne
. 0)) call abort ()
19 if (i
.ne
. 99) call abort ()
20 FORALL (i
=1:4) a(i
) = st3 (i
) ! { dg-error "impure function" "impure reference in FORALL" { xfail *-*-*} }
21 FORALL (i
=1:4) a(i
) = v(i
) ! { dg-error "impure function" }
23 pure
integer function u (x
)
24 integer,intent(in
) :: x
25 st2 (i
) = i
* v(i
) ! { dg-error "impure function" }
28 integer function v (x
)
29 integer,intent(in
) :: x