2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g77.f-torture / execute / io0.f
blobc56c9919077662742c936431c31fd37832aa0de7
1 * Preliminary tests for a few things in the i/o library.
2 * Thrown together by Dave Love not from specific bug reports --
3 * other ideas welcome.
5 character *(*) fmt
6 parameter (fmt='(1x,i3,f5.1)')
7 * Scratch file makes sure we can use one and avoids dealing with
8 * explicit i/o in the testsuite.
9 open(90, status='scratch') ! try a biggish unit number
10 write(90, '()') ! extra record for interest
11 * Formatted i/o can go wild (endless loop AFAIR) if we're wrongly
12 * assuming an ANSI sprintf.
13 write(90, fmt) 123, 123.0
14 backspace 90 ! backspace problems reported on DOSish systems
15 read(90, fmt) i, r
16 endfile 90
17 if (i/=123 .or. nint(r)/=123) call abort
18 rewind 90 ! make sure we can rewind too
19 read(90, '()')
20 read(90, fmt) i, r
21 if (i/=123 .or. nint(r)/=123) call abort
22 close(90)
23 * Make sure we can do unformatted i/o OK. This might be
24 * problematic on DOS-like systems if we've done an fopen in text
25 * mode, not binary.
26 open(90, status='scratch', access='direct', form='unformatted',
27 + recl=8)
28 write(90, rec=1) 123, 123.0
29 read(90, rec=1) i, r
30 if (i/=123 .or. nint(r)/=123) call abort
31 close(90)
32 open(90, status='scratch', form='unformatted')
33 write(90) 123, 123.0
34 backspace 90
35 read(90) i, r
36 if (i/=123 .or. nint(r)/=123) call abort
37 close(90)
38 * Fails at 1998-09-01 on spurious recursive i/o check (fixed by
39 * 1998-09-06 libI77 change):
40 open(90, status='scratch', form='formatted', recl=16,
41 + access='direct')
42 write(90, '(i8,f8.1)',rec=1) 123, 123.0
43 read(90, '(i8,f8.1)', rec=1) i, r
44 if (i/=123 .or. nint(r)/=123) call abort
45 close(90)
46 end