1! { dg-do run }
2program p
3   character(len=20) s1, s2
4   integer, allocatable :: n(:)
5   n = [2,1]
6   s1 = '1 5 2 6 3 0 4 0'
7   write(s2,'(8(I0,1x))') reshape ([1,2,3,4,5,6], [2,4], [0,0], [2,1])
8   if (trim(s1) /= trim(s2)) STOP 1
9   write(s2,'(8(I0,1x))') reshape ([1,2,3,4,5,6], [2,4], [0,0], n)
10   if (trim(s1) /= trim(s2)) STOP 2
11   write(s2,'(8(I0,1x))') reshape ([1,2,3,4,5,6], [2,4], [0,0], [n])
12   if (trim(s1) /= trim(s2)) STOP 3
13end
14