c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / direct_io_11.f90
blobad18d83936ca4054acdda1e324b156b80b9f35a6
1 ! { dg-do run }
2 ! PR42090 Problems reading partial records in formatted direct access files
3 ! Test case from PR, prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 program da_good_now
5 implicit none
6 real :: a, b
8 a = 1.111111111
9 b = 2.222222222
11 open( 10, file = 't.dat', form = 'formatted', access = 'direct', recl = 12 )
12 write( 10, rec = 1, fmt = '( f6.4, /, f6.4 )' ) a, b
13 close( 10 )
15 a = -1.0
16 b = -1.0
18 open( 10, file = 't.dat', form = 'formatted', access = 'direct', recl = 12 )
20 read( 10, rec = 1, fmt = '( f6.4, /, f6.4 )' ) a, b
21 !write( *, '( "partial record 1", t25, 2( f6.4, 1x ) )' ) a, b
22 a = -1.0
23 b = -1.0
25 read( 10, rec = 1, fmt = '( f6.4 )' ) a, b
26 !write( *, '( "partial record 2", t25, 2( f6.4, 1x ) )' ) a, b
27 if (a /= 1.1111 .and. b /= 2.2222) STOP 1
28 a = -1.0
29 b = -1.0
31 read( 10, rec = 1, fmt = '( f12.4, /, f12.4 )' ) a, b
32 !write( *, '( "full record 1", t25, 2( f6.4, 1x ) )' ) a, b
33 if (a /= 1.1111 .and. b /= 2.2222) STOP 2
34 a = -1.0
35 b = -1.0
37 read( 10, rec = 1, fmt = '( f12.4 )' ) a, b
38 !write( *, '( "full record 2", t25, 2( f6.4, 1x ) )' ) a, b
39 if (a /= 1.1111 .and. b /= 2.2222) STOP 3
40 a = -1.0
41 b = -1.0
43 read( 10, rec = 1, fmt = '( f6.4, 6x, /, f6.4, 6x )' ) a, b
44 !write( *, '( "full record with 6x", t25, 2( f6.4, 1x ) )' ) a, b
45 if (a /= 1.1111 .and. b /= 2.2222) STOP 4
46 a = -1.0
47 b = -1.0
49 read( 10, rec = 1, fmt = '( f6.4 )' ) a
50 read( 10, rec = 2, fmt = '( f6.4 )' ) b
51 !write( *, '( "record at a time", t25, 2( f6.4, 1x ) )' ) a, b
52 if (a /= 1.1111 .and. b /= 2.2222) STOP 5
54 close( 10, status="delete")
55 end program da_good_now