empty file needs special case for Ifort

This commit is contained in:
Martin Diehl 2019-03-09 13:38:58 +01:00
parent c3b7ff3a05
commit 7bfd7a42ea
1 changed files with 8 additions and 0 deletions

View File

@ -115,6 +115,10 @@ function IO_read_ASCII(fileName) result(fileContent)
!--------------------------------------------------------------------------------------------------
! read data as stream
inquire(file = fileName, size=fileLength)
if (fileLength == 0) then
allocate(fileContent(0))
return
endif
open(newunit=fileUnit, file=fileName, access='stream',&
status='old', position='rewind', action='read',iostat=myStat)
if(myStat /= 0) call IO_error(100,ext_msg=trim(fileName))
@ -186,6 +190,10 @@ recursive function IO_recursiveRead(fileName,cnt) result(fileContent)
!--------------------------------------------------------------------------------------------------
! read data as stream
inquire(file = fileName, size=fileLength)
if (fileLength == 0) then
allocate(fileContent(0))
return
endif
open(newunit=fileUnit, file=fileName, access='stream',&
status='old', position='rewind', action='read',iostat=myStat)
if(myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=trim(fileName))