2 ! { dg-options "-ffrontend-optimize" }
3 ! PR 86837 - this was mis-optimized by trying to turn this into an
5 ! Original test case by "Pascal".
13 ! number of values per column
14 integer, dimension(3) :: nvalues
15 data nvalues
/ 1, 2, 4 /
17 ! values in a 1D array
18 real, dimension(7) :: one_d
19 data one_d
/ 1, 11, 12, 21, 22, 23, 24 /
21 ! where to store the data back
22 real, dimension(4, 3) :: two_d
24 ! 1 - write our 7 values in one block
25 open(unit
=10, file
="loop.dta", form
="unformatted")
29 ! 2 - read them back in chosen cells of a 2D array
31 open(unit
=10, file
="loop.dta", form
="unformatted", status
='old')
32 read(10) ((two_d(i
,j
), i
=1,nvalues(j
)), j
=1,3)
33 close(unit
=10, status
='delete')
35 ! 4 - print the whole array, just in case
37 if (any(reshape(two_d
,[12]) /= [1.,-9.,-9.,-9.,11.,12.,-9.,-9.,21.,22.,23.,24.])) call abort