Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!labrea!jade!violet.berkeley.edu!lagache From: lagache@violet.berkeley.edu.UUCP Newsgroups: comp.lang.fortran Subject: "Interesting" error interpretation by f77. Message-ID: <5117@jade.BERKELEY.EDU> Date: Thu, 17-Sep-87 01:58:12 EDT Article-I.D.: jade.5117 Posted: Thu Sep 17 01:58:12 1987 Date-Received: Sat, 19-Sep-87 07:13:59 EDT Sender: usenet@jade.BERKELEY.EDU Reply-To: lagache@violet.berkeley.edu (Edouard Lagache) Organization: University of California, Berkeley Lines: 42 Keywords: FORTRAN parsing, error interpretation. Hello to everyone in FORTRAN land! In our introductory FORTRAN classes we have just switched to the f77 compiler. Our first assignment involves students deliberately inserting errors in the code in order to gain familiarity with the compiler's characteristics. This is fine when the teaching staff understands the errors, but a few days ago I hit an error that I couldn't! PROGRAM PRACT REAL NUM1,NUM2,SUM WRITE(*,*) 'Enter two numbers to be added to each other:' READ(*,*) NUM1, NUM2 SUM = NUM1 + NUM2 WRITE(*,*) WRITE(*,*) 'The sum of the two numbers is : ',SUM STOP END %f77 practice.f practice.f: MAIN pract: Error on line 4 of practice.f: syntax error Warning on line 9 of practice.f: local variable num2 never used Warning on line 9 of practice.f: local variable read never used ^^^^ ----------------------------------------------> ???? <--------- After some discussion with the staff, we concluded that the assignment was being interpreted before the I/O statement, but that doesn't give me much satisfaction. My question to the SIG is does this sort of interpretation represent a bug? I am no expert on FORTRAN compiler design, but given this sort of funny business, I wonder what sort of weird code would be passed on as correct!?! Edouard Lagache School of Education U.C. Berkeley lagache@violet.berkeley.edu