File: streamio_6.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A12.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 959,712 kB
  • sloc: cpp: 3,275,382; ansic: 2,061,766; ada: 840,956; f90: 208,513; makefile: 76,132; asm: 73,433; xml: 50,448; exp: 34,146; sh: 32,436; objc: 15,637; fortran: 14,012; python: 11,991; pascal: 6,787; awk: 4,779; perl: 3,054; yacc: 338; ml: 285; lex: 201; haskell: 122
file content (32 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
! { dg-do run }
! PR25828 Stream IO test 6, random writes and reads.
! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
program streamio_6
  implicit none
  integer, dimension(100) :: a
  character(1) :: c
  integer :: i,j,k,ier
  real    :: x
  data a / 13, 9, 34, 41, 25, 98, 6, 12, 11, 44, 79, 3,&
  &    64, 61, 77, 57, 59, 2, 92, 38, 71, 64, 31, 60, 28, 90, 26,&
  &    97, 47, 26, 48, 96, 95, 82, 100, 90, 45, 71, 71, 67, 72,&
  &    76, 94, 49, 85, 45, 100, 22, 96, 48, 13, 23, 40, 14, 76, 99,&
  &    96, 90, 65,  2, 8, 60, 96, 19, 45, 1, 100, 48, 91, 20, 92,&
  &    72, 81, 59, 24, 37, 43, 21, 54, 68, 31, 19, 79, 63, 41,&
  &    42, 12, 10, 62, 43, 9, 30, 9, 54, 35, 4, 5, 55, 3, 94 /

  open(unit=15,file="teststream_streamio_6",access="stream",form="unformatted")
  do i=1,100
    k = a(i)
    write(unit=15, pos=k) achar(k)
  enddo
  do j=1,100
    read(unit=15, pos=a(j), iostat=ier) c
    if (ier.ne.0) then
      STOP 1
    else
      if (achar(a(j)) /= c) STOP 2
    endif
  enddo
  close(unit=15, status="delete")
end program streamio_6