OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [direct_io_11.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! PR42090 Problems reading partial records in formatted direct access files
3
! Test case from PR, prepared by Jerry DeLisle 
4
program da_good_now
5
  implicit none
6
  real :: a, b
7
 
8
  a = 1.111111111
9
  b = 2.222222222
10
 
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 )
14
 
15
  a = -1.0
16
  b = -1.0
17
 
18
  open( 10, file = 't.dat', form = 'formatted', access = 'direct', recl = 12 )
19
 
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
24
 
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) call abort()
28
  a = -1.0
29
  b = -1.0
30
 
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) call abort()
34
  a = -1.0
35
  b = -1.0
36
 
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) call abort()
40
  a = -1.0
41
  b = -1.0
42
 
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) call abort()
46
  a = -1.0
47
  b = -1.0
48
 
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) call abort()
53
 
54
  close( 10, status="delete")
55
end program da_good_now

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.