Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mcnc!ece-csc!ncrcae!ncr-sd!hp-sdd!hplabs!ucbvax!jade!violet.berkeley.edu!lagache From: lagache@violet.berkeley.edu.UUCP Newsgroups: comp.lang.fortran Subject: Compiler confusion between functions and subroutines. Message-ID: <5288@jade.BERKELEY.EDU> Date: Thu, 1-Oct-87 12:44:54 EDT Article-I.D.: jade.5288 Posted: Thu Oct 1 12:44:54 1987 Date-Received: Sat, 3-Oct-87 08:45:57 EDT Sender: usenet@jade.BERKELEY.EDU Reply-To: lagache@violet.berkeley.edu (Edouard Lagache) Organization: University of California, Berkeley Lines: 39 Keywords: Microsoft FORTRAN for Mac., UTAH FORTRAN Hello FORTRAN hackers everywhere! Right on the heals of my recent report of "interesting" parsing by 'f77', I have a lulu for you. Yesterday a student came to me with a very interesting program which had the same character as the following: INTEGER I,J,SQUARE I=4 CALL SQUARE(I,J) PRINT *,I,J STOP END INTEGER FUNCTION SQUARE(I,J) INTEGER I,J J = I**2 RETURN END Impossible? Worse than that, it worked! The fellow said that he was using version 2 of MS-FORTRAN for the Mac. A quick check of the FORTRANs that I could look at gives the following tally: UTAH FORTRAN accepts the code and it runs "correctly" MS-FORTRAN 3.X for PC and f77 finds the error. I wonder how many compilers out there are guilty of this affliction? Edouard Lagache School of Education U.C. Berkeley lagache@violet.berkeley.edu