Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Issue with End-of-File check, Intel Fortran Compiler 2017, Update 1

$
0
0

Hi,

After updating my Fortran compiler from composer XE 2016 to 2017 update 1, I run into an issue with EOF (end-of-file) checks when reading from files. This issue is that the EOF check returns .false. when it should return .true. and consequently reading of variables from a file beyond EOF will lead to an error. I used the Intel example from the EOF help entry to reproduce the issue (see code below and attached VS solution). This error is not found with composer XE 2016.

Andi

 

PROGRAM CheckEOF

IMPLICIT NONE
REAL(4) :: x, total, value
INTEGER(4) :: count, I

OPEN (UNIT=1, FILE = 'TEST.DAT')
DO I = 1, 10
    CALL RANDOM_NUMBER(x)
    WRITE (1, '(F6.3)') x * 100.0
END DO
CLOSE(1)

OPEN (1, FILE = 'TEST.DAT')
count = 0
total = 0.0D0
DO WHILE (.NOT. EOF(1)) !check for end-of-file property
    count = count + 1
    WRITE (*,*) count
    READ (1, *) value
    total = total + value
END DO

IF ( count .GT. 0) THEN
    WRITE (*,*) 'Average is: ', total / count
ELSE
    WRITE (*,*) 'Input file is empty '
END IF
READ(*,*)

END PROGRAM CheckEOF

 

Downloadapplication/zipDownload

Zone: 

Thread Topic: 

Bug Report

Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>