http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46800

           Summary: Handle CTRL-D correctly with STDIN
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jvdeli...@gcc.gnu.org


With the given test case, on READ from STDIN, if an empty entry with LF is
given first, two CTRL-D are required to terminate the read.  G77 requires only
one CTRL-D.

      number=999
   30 write(6,*) 'Enter number1?'
      read(5,*,iostat=ios) number
      write(6,*) 'ios= ',ios
      call bs5(ios)
      if(ios)  20,20,10
   10 write(6,*) 'Input Error'
      go to 30
   20 write(6,*) number
   60 write(6,*) 'Enter number2?'
      read(5,*,iostat=ios) number
      write(6,*) 'ios= ',ios
      call bs5(ios)
      if(ios)  50,50,40
   40 write(6,*) 'Input Error'
      go to 60
   50 write(6,*) number
      end

      subroutine bs5(ios)
      character *20 name
      if(ios.ge.0) go to 20
      name=TtyNam(5)
      close (unit=5)
      open(unit=5,file=name,status='old')
   20 return
      end

Reply via email to