aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/whole_file_10.f90
blob: fb100bb0ed5ef269635b99503b3b7daa1373d2f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
! { dg-do compile }
! { dg-options "-fwhole-file" }
! Test the fix for the fifth problem in PR40011, where the
! entries were not resolved, resulting in a segfault.
!
! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
!
recursive function fac(i) result (res)
  integer :: i, j, k, res
  k = 1
  goto 100
entry bifac(i,j) result (res)
  k = j
100 continue
  if (i < k) then
    res = 1
  else
    res = i * bifac(i-k,k)
  end if
end function

program test
  external fac
  external bifac
  integer :: fac, bifac
  print *, fac(5)
  print *, bifac(5,2)
  print*, fac(6)
  print *, bifac(6,2)
  print*, fac(0)
  print *, bifac(1,2)
end program test