| 1 |
! { dg-do compile } |
| 2 |
! Test the fix for the fifth problem in PR40011, where the |
| 3 |
! entries were not resolved, resulting in a segfault. |
| 4 |
! |
| 5 |
! Contributed by Dominique d'Humieres <[email protected]> |
| 6 |
! |
| 7 |
recursive function fac(i) result (res) |
| 8 |
integer :: i, j, k, res |
| 9 |
k = 1 |
| 10 |
goto 100 |
| 11 |
entry bifac(i,j) result (res) |
| 12 |
k = j |
| 13 |
100 continue |
| 14 |
if (i < k) then |
| 15 |
res = 1 |
| 16 |
else |
| 17 |
res = i * bifac(i-k,k) |
| 18 |
end if |
| 19 |
end function |
| 20 |
|
| 21 |
program test |
| 22 |
external fac |
| 23 |
external bifac |
| 24 |
integer :: fac, bifac |
| 25 |
print *, fac(5) |
| 26 |
print *, bifac(5,2) |
| 27 |
print*, fac(6) |
| 28 |
print *, bifac(6,2) |
| 29 |
print*, fac(0) |
| 30 |
print *, bifac(1,2) |
| 31 |
end program test |