PR c/29467
[official-gcc.git] / gcc / testsuite / gfortran.dg / mapping_2.f90
blob1245c6640bd4de540131ef2c0207a82da4a9d928
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.
6 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
8 module 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
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
23 end module test
25 program len_test
26 use test
27 implicit none
28 real x(7)
30 if (my_string(x) .ne. "01234567890") call abort ()
31 end program len_test