Merge from mainline.
[official-gcc.git] / gcc / testsuite / gfortran.dg / recursive_statement_functions.f90
blob8f9b09183702cfcd81920d8cfff1560f51e83b6c
1 ! { dg-do compile }
2 ! PR20866 - A statement function cannot be recursive.
3 ! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
5 ! Modified 20051110 to check that regressions PR24655 and PR24755
6 ! are fixed. Thanks to pavarini@pv.infn.it and tdeutsch@cea.fr for
7 ! the tests.
9 INTEGER :: i, st1, st2, st3, lambda, n
10 REAL :: x, z(2,2)
11 character(8) :: ch
12 real(8) :: fi, arg, sigma, dshpfunc
13 real(8), parameter :: one=1d0
15 ! Test check for recursion via other statement functions, string
16 ! length references, function actual arguments and array index
17 ! references.
19 st1 (i) = len (ch(st2 (1):8))
20 st2 (i) = max (st3 (1), 4)
21 st3 (i) = 2 + cos (z(st1 (1), i)) ! { dg-error "is recursive" }
23 ! Test the two regressions.
25 fi (n) = n *one
26 dshpfunc (arg)=-lambda/sigma*(arg/sigma)**(lambda-1)*exp(-(arg/sigma)**lambda)
28 ! References to each statement function.
30 write(6,*) st1 (1), fi (2), dshpfunc (1.0_8)
31 END