1! { dg-do compile }
2! { dg-options "-fwhole-file" }
3!
4! PR fortran/41235
5!
6
7character(len=*) function func()
8  func = 'ABC'
9end function func
10
11subroutine test(i)
12  integer :: i
13  character(len=i), external :: func
14  print *, func()
15end subroutine test
16
17subroutine test2(i)
18  integer :: i
19  character(len=i) :: func
20  print *, func()
21end subroutine test2
22
23call test(2)
24call test2(2)
25end
26