! { dg-do run } ! ! The gimplifier used to throw a fit on the write statements in f1 and f2. ! ! Contributed by Gerhard Steinmetz ! module m character(6) :: buffer contains integer function g(x) integer :: x g = x end integer function f1(x) character(*) :: x(*) write (buffer(1:3),'(i2)') g(x%len) end integer function f2(x) character(*) :: x(3) write (buffer(4:6),'(i2)') g(x%len) end end module m use m integer :: i(2), j character(2), dimension(3) :: chr = ['ab','cd','ef'] i(1) = f1(chr) i(2) = f2(chr) if (any (i .eq.2)) stop 1 if (trim(buffer) .ne. ' 2 2') stop 2 end