For Programmers: Free Programming Magazines  


Home > Archive > Fortran > October 2006 > Re: Why these original FORTRAN quirks?; Now : Programming practices









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Why these original FORTRAN quirks?; Now : Programming practices
Walter Spector

2006-10-30, 7:15 pm

"Rostyslaw J. Lewyckyj" wrote:

As Richard Maine noted, the above is a Fortran-66ism that was removed
when Fortran-77 was written. So in modern Fortran it should give a
run-time error. Possibly some compilers are smart enough to detect
it at compile time.
[color=darkred]
> I don't have access to a computer with Fortran anymore.
> But would someone pleast try it, especialy on an IBM system
> to verify that it won't work any more.


Well, for 'funsies' I tried it out with some ancient CDC compilers:

/list
PROGRAM TESTHOL (INPUT, OUTPUT, TAPE5=INPUT, TAPE6=OUTPUT)
10 READ (5,100)
IF (EOF (5) .EQ. 1) GO TO 20
WRITE (6,100)
GO TO 10

20 STOP

100 FORMAT (80H
& )
END
/

With FTN (version 4.8+538), which was CDCs main F66 compiler for many years,
the above works as it is required to by the F66 Standard.

With MNF (version 5.4), which was a popular student compiler
written at the U of Minnesota, the above also works.

With FTN5 (version 5.1+538), CDCs main F77 compiler, the error is detected
at run-time:

/lgo
? this is a test
FORMAT (80H
....'.....12345678901234567890
0*ERROR WITH FORMAT NO. 100 :*H,',", ILLEGAL INPUT FORMATS
FTN - FATAL ERROR NUMBER 167
TRACEBACK INITIATED BY SYSERR AT REL(ABS) ADDRESS 122(13261).
CALLED BY FECESE. AT ADDRESS 304(13415) WITH NO AP-LIST.
CALLED BY FMTAP= AT ADDRESS 416(2402) WITH NO AP-LIST.
CALLED BY INPC= AT ADDRESS 111(4733) WITH NO AP-LIST.
CALLED BY TESTHOL AT LINE 2, ADDRESS 22(123) WITH APLIST 11453(11554).
.018 CP SECONDS EXECUTION TIME.
/return,lgo

And finally, with M77 (version 2.1), the U of Minnesotas F77 followon
to MNF, the old code works! However, at EOF I got:

/lgo
? this is a test
THIS IS A TEST
? of the fortran-66 capability to
OF THE FORTRAN-66 CAPABILITY TO
? read data into a format statement
READ DATA INTO A FORMAT STATEMENT
?
FORMAT .;
*
ILLEGAL CHARACTER OR INCORRECT NUMBER IN FORMAT
ERROR NUMBER 68 FOUND IN INOUT=
CALLED BY TESTHOL AT LINE 4
EXCHANGE PACKAGE/MEMORY DUMP ON FILE ZZZDUMP.
ILLEGAL I/O REQUEST ON FILE ZZZZDMP AT 4463.
/

Sadly, the old CDC RUN compiler is probably lost to the 'Great Bit Bucket in
the Sky'.

I tried something similar to the above on either the Cray or SGI
compilers (or both) a few years ago, and the feature seemed to have
been 'forgotten about'.

Walt
Morten Reistad

2006-10-30, 7:15 pm

In article <453F6126.2E6CFCA9@earthlink.net>,
Walter Spector <w6ws_xthisoutx@earthlink.net> wrote:[color=darkred]
>"Rostyslaw J. Lewyckyj" wrote:

I just had to test with g77. With -ff66 it says

mrr@pilt tmp]$ cat ff.f
PROGRAM TESTHOL
10 READ (5,100,END=20)
WRITE (6,100)
GO TO 10

20 STOP

100 FORMAT (80H
& )
END

[mrr@pilt tmp]$ g77 -ff66 ff.f -o ff
[mrr@pilt tmp]$ ./ff
foo
foo
bar
bar
[mrr@pilt tmp]$

Works with -ff77 and -ff90 as well.

It just proves that sometimes old dogs can learn new tricks.

-- mrr
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com