Fortran bug?
Tony Facca
fsfacca at LERC08.LERC.NASA.GOV
Tue Dec 5 04:58:58 AEST 1989
Knobi der Rechnerschrat <XBR2D96D%DDATHD21.BITNET at cunyvm.cuny.edu> writes:
> I discovered the following two bugs in the C and f77 compiler of 3.2. I know
>I should report them directly to Calvin Vu, but I've lost his e-mail address.
>
> First I have the following Fortran Code:
>
> program test
> numatm = -1
> write(*,4711)
>4711 format('Next comes the bug',i4)
> 1 numatm
> end
[ I did some editing, but the idea has been preserved ]
>
> The program compiles fine, but tell me where does is put the continuation
>line? To the format statement? That's nonsense? To the write statement? That
>would be the meaning, but to late and it doesn't.
>
The continuation line is just that: a continuation of the FORMAT statement.
So, the 4th line of the program is:
4711 format ('Next comes the bug', i4) numatm
That much is obvious, right?
So, why doesn't the compiler complain? According to the ANSI X3.9-1978
(FORTRAN 77), Section 13.1.2 says:
"Character data may follow the right parenthesis that ends the format
specification, with no effect on the format specification."
Looks like this piece of code conforms to the standard quite nicely. The point
about it being nonsense is still debatable. But at least its FORTRAN 77
STANDARD nonsense! :-)
Tony Facca & Dan Whipple
--
-----------------------------------------------------------------------------
Tony Facca | phone: 216-433-8318
NASA Lewis Research Center |
Cleveland, Ohio 44135 | email: fsfacca at lerc08.lerc.nasa.gov
-----------------------------------------------------------------------------
More information about the Comp.sys.sgi
mailing list