| 1 |
! { dg-do compile } |
| 2 |
! Test the fix for the fourth 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 |
program test |
| 8 |
interface |
| 9 |
function bad_stuff(n) |
| 10 |
integer :: bad_stuff (2) |
| 11 |
integer :: n(2) |
| 12 |
end function bad_stuff |
| 13 |
recursive function rec_stuff(n) result (tmp) |
| 14 |
integer :: n(2), tmp(2) |
| 15 |
end function rec_stuff |
| 16 |
end interface |
| 17 |
integer :: res(2) |
| 18 |
res = bad_stuff((/-19,-30/)) |
| 19 |
|
| 20 |
end program test |
| 21 |
|
| 22 |
recursive function bad_stuff(n) |
| 23 |
integer :: bad_stuff (2) |
| 24 |
integer :: n(2), tmp(2), ent = 0, sent = 0 |
| 25 |
save ent, sent |
| 26 |
ent = -1 |
| 27 |
entry rec_stuff(n) result (tmp) |
| 28 |
if (ent == -1) then |
| 29 |
sent = ent |
| 30 |
ent = 0 |
| 31 |
end if |
| 32 |
ent = ent + 1 |
| 33 |
tmp = 1 |
| 34 |
if(maxval (n) < 5) then |
| 35 |
tmp = tmp + rec_stuff (n+1) |
| 36 |
ent = ent - 1 |
| 37 |
endif |
| 38 |
if (ent == 1) then |
| 39 |
if (sent == -1) then |
| 40 |
bad_stuff = tmp + bad_stuff (1) |
| 41 |
end if |
| 42 |
ent = 0 |
| 43 |
sent = 0 |
| 44 |
end if |
| 45 |
end function bad_stuff |