PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / spec_expr_7.f90
blobc710f3b2611ef2dc6a37a4a386dbd24f648a377e
1 ! { dg-do run }
3 ! PR 60777: [F03] RECURSIVE function rejected in specification expression
5 ! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com>
7 module recur
8 implicit none
9 contains
11 pure recursive function f(n) result(answer)
12 integer, intent(in) :: n
13 integer :: answer
14 if (n<2) then
15 answer = 1
16 else
17 answer = f(n-1)*n
18 end if
19 end function
21 pure function usef(n)
22 integer,intent(in) :: n
23 character(f(n)) :: usef
24 usef = repeat('*',f(n))
25 end function
26 end module
28 program testspecexpr
29 use recur
30 implicit none
31 if (usef(1) /= '*') STOP 1
32 if (usef(2) /= '**') STOP 2
33 if (usef(3) /= '******') STOP 3
34 end