| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR fortran/38095 |
| 4 |
! |
| 5 |
! Contributed by Vivek Rao |
| 6 |
! |
| 7 |
! Compiling the program below gave an ICE |
| 8 |
! |
| 9 |
module bar |
| 10 |
implicit none |
| 11 |
contains |
| 12 |
elemental function trim_append(xx,yy) result(xy) |
| 13 |
character (len=*), intent(in) :: xx,yy |
| 14 |
character (len=len(xx) + len(yy)) :: xy |
| 15 |
xy = trim(xx) // yy |
| 16 |
end function trim_append |
| 17 |
function same(xx) result(yy) |
| 18 |
character (len=*), intent(in) :: xx(:) |
| 19 |
character (len=len(xx)) :: yy(size(xx)) |
| 20 |
yy = [xx] |
| 21 |
end function same |
| 22 |
subroutine foo(labels) |
| 23 |
character (len=*), intent(in) :: labels(:) |
| 24 |
print*,"size(labels)=",size(labels) |
| 25 |
end subroutine foo |
| 26 |
subroutine xmain() |
| 27 |
call foo(trim_append(["a"],same(["b"]))) |
| 28 |
end subroutine xmain |
| 29 |
end module bar |
| 30 |
|
| 31 |
program main |
| 32 |
use bar |
| 33 |
call xmain() |
| 34 |
end program main |