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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! { dg-options "-std=legacy" }
3
!
4
! PR32235 incorrectly position text file after backspace
5
! Test case from PR, prepared by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
6
      program main
7
      character*10 a
8
      ncards=2
9
      input=10
10
      write(10,"(a)") "One"
11
      write(10,"(a)") "Two"
12
      write(10,"(a)") "Three"
13
      rewind(10)
14
      read(input,1000)a
15
      read(input,1000)a
16
 
17
      call inlist(ncards)
18
 
19
      read(input,1000)a
20
      if (a.ne."Three") call abort
21
      close(10,status="delete")
22
      stop
23
 1000 format(a10)
24
 2000 format('read =',a10)
25
      end
26
 
27
      subroutine inlist(ncards)
28
      character*4 data(20)
29
      input=10
30
c
31
      if (ncards.eq.0) go to 20
32
      do 15 i=1,ncards
33
      backspace input
34
   15 continue
35
c
36
   20 continue
37
      kard  = 0
38
   30 read(input,1000,end=60)   data
39
   40 kard=kard + 1
40
   50 continue
41
      if ((kard .eq. 1) .and. (DATA(1) .ne. "One")) call abort
42
      if ((kard .eq. 2) .and. (DATA(1) .ne. "Two")) call abort
43
      if ((kard .eq. 3) .and. (DATA(1) .ne. "Thre")) call abort
44
 
45
      go to 30
46
   60 continue
47
      kard=kard - ncards + 1
48
      do 70   i=1,kard
49
      backspace input
50
   70 continue
51
c
52
      return
53
c
54
 1000 format (20a4)
55
 2020 format (8x,i15,8x,20a4)
56
c
57
      end

powered by: WebSVN 2.1.0

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