module foo
	implicit none
contains

	subroutine copyt(chars, array)
		character::			array(:, :, :, :)
		character(len = size(array))::	chars
	continue
		chars = transfer(array, chars)
	end subroutine

	subroutine copyi(chars, array)
		character::			array(:, :, :, :)
		character(len = size(array))::	chars
		integer::			o1, o2, o3, o4, u(4), l(4), i
	continue
		u = ubound(array)
		l = lbound(array)
		i = 0
		do, o1 = l(1), u(1)
		do, o2 = l(2), u(2)
		do, o3 = l(3), u(3)
		do, o4 = l(4), u(4)
			i = i + 1
			chars(i: i) = array(o1, o2, o3, o4)
		enddo
		enddo
		enddo
		enddo
	end subroutine

end module

program test
	use foo
	integer, parameter:: BUFLEN = 100
	character(len = BUFLEN):: chars
	character:: array(BUFLEN, 1, 1, 1)
	integer:: i, j, start(8), stop(8)
continue
	call date_and_time(values = start)
	do, j = 1, 100
	do, i = 0, 255
		array(:, 1, 1, 1) = achar(i)
		call copyt(chars, array)
	enddo
	enddo
	call date_and_time(values = stop)
	print *, real(stop(7) * 1000 + stop(8) - start(7) * 1000 - start(8)) &
		& / 1000.0
end program


