This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Possible g77 bug


The program does not conform to the F77 standard, thus it is not a bug. 

You must test for EOF by checking the IOSTAT variable or by using the
"END=statement", not by using "ERR=statement".  


Take a look at the ANSI X3.9-1978 FORTRAN language standard, it covers
this in some detail. Do a google search, copies are available on the
web.

 
regards,
bud davis
 


On Thu, 2002-12-19 at 19:31, Mats Peterson wrote:
> Hello.
> 
> The code below doesn't work with g77 in either FreeBSD or Linux.
> Try pressing Control-D and watch it loop forever.
> It does work with the Compaq Fortran compiler.
> 
> g77 version: GNU Fortran 0.5.25 20010315 (release)
> FreeBSD version: 4.6.2-RELEASE-p5
> Linux version: 2.4.18
> 
> ---------------------------------------------------------
> 
>       PROGRAM TEST
>    10 READ (UNIT=*, FMT=*, IOSTAT=NERR, ERR=100) N
>       PRINT *, 'You entered ', N
>       GO TO 10
>   100 IF (NERR .LT. 0) THEN
>          PRINT *, 'EOF'
>          STOP
>       ENDIF
>       PRINT *, 'Invalid input'
>       GO TO 10
>       END
> 
> ---------------------------------------------------------
> 
> Regards,
> Mats Peterson
> 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]