| 1 |
! { dg-do compile } |
| 2 |
! PR 18883: Fake result variables of non-constant length, with ENTRY |
| 3 |
function s_to_c(chars) |
| 4 |
character, pointer :: chars(:) |
| 5 |
character(len=len(chars)) :: s_to_c, s_to_c_2 |
| 6 |
s_to_c = 'a' |
| 7 |
return |
| 8 |
entry s_to_c_2(chars) |
| 9 |
s_to_c_2 = 'b' |
| 10 |
return |
| 11 |
end function s_to_c |
| 12 |
|
| 13 |
program huj |
| 14 |
|
| 15 |
implicit none |
| 16 |
interface |
| 17 |
function s_to_c(chars) |
| 18 |
character, pointer :: chars(:) |
| 19 |
character(len=len(chars)) :: s_to_c |
| 20 |
end function s_to_c |
| 21 |
|
| 22 |
function s_to_c_2(chars) |
| 23 |
character, pointer :: chars(:) |
| 24 |
character(len=len(chars)) :: s_to_c_2 |
| 25 |
end function s_to_c_2 |
| 26 |
end interface |
| 27 |
|
| 28 |
character, pointer :: c(:) |
| 29 |
character(3) :: s |
| 30 |
|
| 31 |
allocate(c(5)) |
| 32 |
c = (/"a", "b", "c" /) |
| 33 |
s = s_to_c(c) |
| 34 |
s = s_to_c_2(c) |
| 35 |
|
| 36 |
end program huj |