Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

New unit, inquire and recursive i/o

David_Kinniburgh
Beginner
338 Views

[fortran]

program test_inquire

implicit none

integer :: i, ios, iunit, junit

 

open (newunit=iunit, file = 'new.dat', status = 'OLD', iostat = ios)

 

do i = 1,2

   inquire (file = 'missing1.dat',  number = junit, iostat = ios) 

   if (ios.eq.0) then
      print *, i, 'ok'
   elseif (ios .eq. 40) then
      print *, i, 'Recursive i/o'
   else
      print *, i, "ios = ", ios
   endif

enddo

end program test_inquire

[/fortran]

The second time round, this seems to catch a recursive i/o error. gfortran runs without error.

 

 

0 Kudos
3 Replies
andrew_4619
Honored Contributor II
338 Views

I tried that with XE 14.0.1.139 [IA-32] and get the same result.

whilst the example of making the same enquiry twice makes no sense, the result is still wrong IMO also.

 

0 Kudos
andrew_4619
Honored Contributor II
338 Views

[fortran]

   inquire (file = 'missing1.dat',  number = junit1, iostat = ios) 
   inquire (file = 'missing2.dat',  number = junit2, iostat = ios) 
   inquire (file = 'missing1.dat',  number = junit3, iostat = ios)

[/fortran]

Gives ios=0 40 and 40 which is even more wrong!

Compiler XE 13.1.3.198 [IA-32] gives the same results

0 Kudos
Kevin_D_Intel
Employee
338 Views

Thank you for reporting this error. FWIW, the case behaves correctly under Linux but incorrectly on Windows as was noted. I forwarded it to Development and will post updated status as I learn it.

(Internal tracking id: DPD200250673)

0 Kudos
Reply