| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR fortran/55827 |
| 4 |
! gfortran used to ICE with the call to `tostring' depending on how the |
| 5 |
! `tostring' symbol was USE-associated. |
| 6 |
! |
| 7 |
! Contributed by Lorenz Hüdepohl <[email protected]> |
| 8 |
|
| 9 |
module stringutils |
| 10 |
interface |
| 11 |
pure function strlen(handle) result(len) |
| 12 |
integer, intent(in) :: handle |
| 13 |
integer :: len |
| 14 |
end function |
| 15 |
end interface |
| 16 |
end module |
| 17 |
module intermediate ! does not die if this module is merged with stringutils |
| 18 |
contains |
| 19 |
function tostring(handle) result(string) |
| 20 |
use stringutils |
| 21 |
integer, intent(in) :: handle |
| 22 |
character(len=strlen(handle)) :: string |
| 23 |
end function |
| 24 |
end module |
| 25 |
module usage |
| 26 |
contains |
| 27 |
subroutine dies_here(handle) |
| 28 |
use stringutils ! does not die if this unnecessary line is omitted or placed after "use intermediate" |
| 29 |
use intermediate |
| 30 |
integer :: handle |
| 31 |
write(*,*) tostring(handle) ! ICE |
| 32 |
end subroutine |
| 33 |
end module |
| 34 |
|
| 35 |
|