[Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads

2008-07-25 Thread michael dot e dot olsen at nasa dot gov


--- Comment #5 from michael dot e dot olsen at nasa dot gov  2008-07-25 
22:51 ---
Created an attachment (id=15964)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15964&action=view)
Version showing iostat isn't distinguishing either.

This version is a little more involved, and opens and closes the file to create
error and end conditions.  iostat allways returns 0 for normal cases, and -1
for either end or error conditions


-- 


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



[Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads

2008-07-25 Thread michael dot e dot olsen at nasa dot gov


--- Comment #2 from michael dot e dot olsen at nasa dot gov  2008-07-25 
22:37 ---
Created an attachment (id=15963)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15963&action=view)
Version showing iostat isn't distinguishing either.

This version is a little more involved, and opens and closes the file to create
error and end conditions.  iostat allways returns 0 for normal cases, and -1
for either end or error conditions


-- 


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



[Bug fortran/36942] iostat and/or end= and Err= don't work in read statements, unformatted reads

2008-07-25 Thread michael dot e dot olsen at nasa dot gov


--- Comment #1 from michael dot e dot olsen at nasa dot gov  2008-07-25 
22:35 ---
Created an attachment (id=15962)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15962&action=view)
Coding to reproduce bug described

Didn't know I could add attachment.  I'll add one demonstrating that iostat has
the same behavior


-- 


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



[Bug fortran/36942] New: iostat and/or end= and Err= don't work in read statements, unformatted reads

2008-07-25 Thread michael dot e dot olsen at nasa dot gov
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