public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36942]  New: iostat and/or end= and Err= don't work in read statements, unformatted reads
@ 2008-07-25 22:31 michael dot e dot olsen at nasa dot gov
  2008-07-25 22:36 ` [Bug fortran/36942] " michael dot e dot olsen at nasa dot gov
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: michael dot e dot olsen at nasa dot gov @ 2008-07-25 22:31 UTC (permalink / raw)
  To: gcc-bugs

Coding to detect end of file or read error just won't work, and I can't see a
work around.  Coding to differentiate between end of file and error condition
doesn't work, it all acts like an error.

I have a test code, included below, which creates a simple unformatted file
with two records.  The first record contains a single integer, and the second
record contains three integers.  

Once this test file is created, it is re-opened and read, attempting a read of
three integers, rather than 1 integer, on the first record. This should create
a error condition, and it should write out the stop error message stating so. 
Instead, it writes out the message for the END=100 label.  

Using IOSTAT doesn't differentiate between end= and err= conditions either, it
seems to return 0 for no problems, and -1 for anything else...

Code has been run on opteron, centrino, and itanium systems, all running linux
(fedora core 8 on the first two, last Suse)

!---Relevant Code follows----
      integer ni, nj, nk
      ni = 1
      nj = 1
      nk = 1
      open(1,file='test.data',form='unformatted')
      write(1) ni
      write(1) ni,nj,nk
      close(1)
      ni = 0
      nj = 0
      nk = 0
      open(1,file='test.data',form='unformatted')
      read(1,err=10,end=100)ni,nj,nk
      write(*,*)ni, nj, nk
      stop 'No End, No ERror'
   10 continue
      write(*,*)ni, nj, nk
      stop 'ERror'
  100 continue
      write(*,*)ni, nj, nk
      stop 'End'
      end
!-------------------End of Code ----------------


-- 
           Summary: iostat and/or end= and Err= don't work in read
                    statements, unformatted reads
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot e dot olsen at nasa dot gov


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-26  1:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-25 22:31 [Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads michael dot e dot olsen at nasa dot gov
2008-07-25 22:36 ` [Bug fortran/36942] " michael dot e dot olsen at nasa dot gov
2008-07-25 22:38 ` michael dot e dot olsen at nasa dot gov
2008-07-25 22:41 ` kargl at gcc dot gnu dot org
2008-07-25 22:45 ` kargl at gcc dot gnu dot org
2008-07-25 22:52 ` michael dot e dot olsen at nasa dot gov
2008-07-26  0:10 ` kyon at verizon dot net
2008-07-26  1:19 ` kargl at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).