2 ! { dg-options "-O -fdump-tree-original" }
4 ! This test ensures optimization of implied do loops in io statements
9 integer, parameter:: k
= 2, linenum
= 14
10 integer, dimension(2):: a
= [(i
, i
=1,2)]
11 integer, dimension(2,2):: b
= reshape([1, 2, 3, 4], shape(b
))
12 character (len
=30), dimension(linenum
) :: res
13 character (len
=30) :: line
15 integer, dimension(2):: i
17 type(tp
), dimension(2):: t
= [tp([1, 2]), tp([1, 2])]
34 open(10,file
="test.dat")
36 write (10,1000) 'a', (a(k
), i
=1,2)
37 write (10,1000) 'b', (b(i
, 1), i
=1,2)
38 write (10,1000) 'c', b(1:2:1, 1)
39 write (10,1000) 'd', (a(i
), i
=1,2)
40 write (10,1000) 'e', ((a(i
), i
=1,2), j
=1,2)
41 write (10,1000) 'f', (a
, b(i
, 1), i
= 1,2)
42 write (10,1000) 'g', ((b(i
, j
), i
=1,2),j
=1,2)
43 write (10,1000) 'h', ((b(j
, i
), i
=1,2),j
=1,2)
44 write (10,1000) 'i', (a(i
+1), i
=1,1)
45 write (10,1000) 'j', (a(i
*2), i
=1,1)
46 write (10,1000) 'k', (a(i
), i
=1,2), (a(i
), i
=1,2)
47 write (10,1000) 'l', (a(i
), i
=1,1)
48 write (10,1000) 'm', (1, i
=1,2)
49 write (10,1000) 'n', (t(i
)%i(i
), i
=1,2)
53 if (line
.ne
. res(i
)) STOP 1
55 close(10,status
="delete")
56 1000 format (A2
,100I4
)
59 ! { dg-final { scan-tree-dump-times "(?n)^\\s*while \\(1\\)$" 7 "original" } }