* config/sparc/driver-sparc.c (cpu_names): Add SPARC-T5 entry.
[official-gcc.git] / gcc / testsuite / gfortran.dg / stfunc_6.f90
blob37137fb41f8bb9570b2bc3c76311bcd631dcb856
1 ! { dg-do compile }
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
14 st1 (i) = i * i * i
15 st3 (i) = i * v(i)
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" }
22 contains
23 pure integer function u (x)
24 integer,intent(in) :: x
25 st2 (i) = i * v(i) ! { dg-error "impure function" }
26 u = st2(x)
27 end function
28 integer function v (x)
29 integer,intent(in) :: x
30 v = i
31 end function
32 end