2015-07-03 Christophe Lyon <christophe.lyon@linaro.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / whole_file_10.f90
blobfb100bb0ed5ef269635b99503b3b7daa1373d2f2
1 ! { dg-do compile }
2 ! { dg-options "-fwhole-file" }
3 ! Test the fix for the fifth problem in PR40011, where the
4 ! entries were not resolved, resulting in a segfault.
6 ! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
8 recursive function fac(i) result (res)
9 integer :: i, j, k, res
10 k = 1
11 goto 100
12 entry bifac(i,j) result (res)
13 k = j
14 100 continue
15 if (i < k) then
16 res = 1
17 else
18 res = i * bifac(i-k,k)
19 end if
20 end function
22 program test
23 external fac
24 external bifac
25 integer :: fac, bifac
26 print *, fac(5)
27 print *, bifac(5,2)
28 print*, fac(6)
29 print *, bifac(6,2)
30 print*, fac(0)
31 print *, bifac(1,2)
32 end program test