nvptx, libgfortran: Switch out of "minimal" mode
[official-gcc.git] / gcc / testsuite / gfortran.dg / implied_do_io_6.f90
blobebc99b234d157630bdd4c0e2fa13f8572826371e
1 ! { dg-do run }
2 ! { dg-options "-ffrontend-optimize" }
3 ! PR 86837 - this was mis-optimized by trying to turn this into an
4 ! array I/O statement.
5 ! Original test case by "Pascal".
7 Program read_loop
9 implicit none
11 integer :: i, j
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")
26 write(10) one_d
27 close(unit=10)
29 ! 2 - read them back in chosen cells of a 2D array
30 two_d = -9
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
39 end Program read_loop