For the following program, the IOSTAT is properly set to /= 0 (namely to -1),
but the ERR= is ignored. If iostat= is not present, a run-time error is shown,
otherwise after the read statement is continued as if nothing had happened.

My test case, based on e73 test case of the Fortran 95 testsuite.

implicit none
integer :: iou, i, ir, TEMP_CHANGES
iou=9
i=44
ir = -42
open(iou,access="direct",recl=1000,status="scratch")
! Variant 1: Gives run-time error instead of jumping to 99
!READ (11, REC = I, ERR = 99) TEMP_CHANGES
! Variant 2: ir is ok, but does not jump to 99
READ (11, REC = I, IOSTAT = IR, ERR = 99) TEMP_CHANGES
print *, 'Should not be reached; ir = ', ir
stop
99 continue
if(ir == 0) then
  print *,'ERROR: ir should not be 0'
  stop
end if
print *, 'OK'
end


-- 
           Summary: On error, no jump to ERR=<label>
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 32834
             nThis:


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

Reply via email to