🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.f77
Article #363

Re: f77 bug: comparing logicals

#363
From: gast
Date: Thu, 22 May 1986 06:24
73 lines
3620 bytes
In article <1456@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes:
>In article <12846@ucla-cs.ARPA> gast@ucla-cs.UUCP (David Gast) writes:
>>Now to the example at hand.  F77 does not allow the .eq. operator
>>between logicals.  There is a syntax error not detected by the 
>>compiler. Isn't FORTRAN a great language?
>
>Why do you blame the language after (correctly) identifying the compiler as
>being at fault?

(The best is saved for last)

In the first place, why should the language have different operators?
Obviously, the compiler writers thought that it was silly or they would
not have allowed .eq. between the logicals.  

Secondly, FORTRAN is full of constructs which cannot be caught 
by the compiler and are never caught by the run-time system due 
to the extreme expense involved.  I am not just talking about 
checking for variable initializations and simple things that 
could be caught (and that could be caught without slowing the 
machine down appreciably if the machine architectures were better).  
I am speaking of things like making sure that two formal parameters 
do not alias the same memory location if one of them is "defined" 
in f77 parlance during the execution of the subroutine or function 
or any units called by it.

Part of the reason for not detecting these errors is that
initially FORTRAN was designed to be as fast as assembly language
on the particular IBM machine.  (Kind of like C and the PDP).  Error
checking would have slowed the computer down.

Thirdly, the language has changed too much through the years.
Current errors were quite possibly legal in earlier versions 
of FORTRAN.  The manufacturers do not want to produce a compiler 
that complains that something is illegal because then all those 
people with all those millions of lines of code would have to 
recompile and worse re-write their code.  (Of course the programs 
do not really work).

Here is are two examples:

         i=10
         j=1
         do 10 i = i,j
            ...
10       continue

This loop must execute exactly 0 times in f77.  It is not permitted to
let it executed once.  Futhermore, the number of times that this loop
executes in f66 is NOT once.  In f66 this loop is undefined.  Before
you start to flame, look it up in the ansi document.

        subroutine p (x)
        data a/0/
        x = a
        a = a + 1
        end

In f77 what value is assigned to x the second time p is called?  The answer 
is implementation dependent.  The f77 standard allows either a stack 
implementation (in which case the answer is 0) or the regular "static"
implementation (in which case the answer is 1).  To force the answer
to be one, the user must save the variable a.

Now I ask you "Is a language which allows two different answers for some-
thing like this a reasonable language?"  I think not.
 
David Gast

PS I have not even mentioned all of the mundane matters that get
discussed ad infinitum.

!inhp4!ucla-cs!gast
Technical Details
Message-ID: <13987@ucla-cs.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!ucbvax!sdcsvax!sdcrdcf!ucla-cs!gast
References: <464@cubsvax.UUCP> <12846@ucla-cs.ARPA> <1456@mmintl.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!ucbvax!sdcsvax!sdcrdcf!ucla-cs!gast
From: gast@ucla-cs.UUCP
Newsgroups: net.lang.f77
Subject: Re: f77 bug:  comparing logicals
Message-ID: <13987@ucla-cs.ARPA>
Date: Thu, 22-May-86 02:24:10 EDT
Article-I.D.: ucla-cs.13987
Posted: Thu May 22 02:24:10 1986
Date-Received: Sat, 24-May-86 21:27:08 EDT
References: <464@cubsvax.UUCP> <12846@ucla-cs.ARPA> <1456@mmintl.UUCP>
Reply-To: gast@ucla-cs.UUCP (David Gast)
Organization: UCLA Computer Science Dept.
Lines: 73