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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [unformatted_subrecord_1.f90] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do run }
2
! { dg-options "-fmax-subrecord-length=16" }
3
! Test Intel record markers with 16-byte subrecord sizes.
4
program main
5
  implicit none
6
  integer, dimension(20) :: n
7
  integer, dimension(30) :: m
8
  integer :: i
9
  real :: r
10
  integer :: k
11
  ! Maximum subrecord length is 16 here, or the test will fail.
12
  open (10, file="f10.dat", &
13
       form="unformatted", access="sequential")
14
  n = (/ (i**2, i=1, 20) /)
15
  write (10) n
16
  close (10)
17
  ! Read back the file, including record markers.
18
  open (10, file="f10.dat", form="unformatted", access="stream")
19
  read (10) m
20
  if (any(m .ne. (/ -16, 1, 4, 9, 16, 16, -16, 25, 36, 49, 64, &
21
       -16, -16, 81, 100, 121, 144, -16, -16, 169, 196, 225, &
22
       256, -16, 16, 289, 324, 361, 400, -16 /))) call abort
23
  close (10)
24
  open (10, file="f10.dat", form="unformatted", &
25
       access="sequential")
26
  m = 42
27
  read (10) m(1:5)
28
  if (any(m(1:5) .ne. (/ 1, 4, 9, 16, 25 /))) call abort
29
  if (any(m(6:30) .ne. 42)) call abort
30
  backspace 10
31
  n = 0
32
  read (10) n(1:5)
33
  if (any(n(1:5) .ne. (/ 1, 4, 9, 16, 25 /))) call abort
34
  if (any(n(6:20) .ne. 0)) call abort
35
  ! Append to the end of the file
36
  write (10) 3.14
37
  ! Test multiple backspace statements
38
  backspace 10
39
  backspace 10
40
  read (10) k
41
  if (k .ne. 1) call abort
42
  read (10) r
43
  if (abs(r-3.14) .gt. 1e-7) call abort
44
  close (10, status="delete")
45
end program main

powered by: WebSVN 2.1.0

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