1! { dg-do run }
2! Tests the fix for PR33998, in which the chain of expressions
3! determining the character length of my_string were not being
4! resolved by the formal to actual mapping.
5!
6! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
7!
8module test
9   implicit none
10   contains
11      function my_string(x)
12         integer i
13         real, intent(in) :: x(:)
14         character(0) h4(1:minval([(i,i=30,32), 15]))
15         character(0) sv1(size(x,1):size(h4))
16         character(0) sv2(2*lbound(sv1,1):size(h4))
17         character(lbound(sv2,1)-3) my_string
18
19         do i = 1, len(my_string)
20            my_string(i:i) = achar(modulo(i-1,10)+iachar('0'))
21         end do
22      end function my_string
23end module test
24
25program len_test
26   use test
27   implicit none
28   real x(7)
29
30   if (my_string(x) .ne. "01234567890") call abort ()
31end program len_test
32