Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!uxe.cso.uiuc.edu!hirchert From: hirchert@uxe.cso.uiuc.edu.UUCP Newsgroups: comp.lang.fortran Subject: Re: "Interesting" error interpretation Message-ID: <50500009@uxe.cso.uiuc.edu> Date: Fri, 18-Sep-87 13:08:00 EDT Article-I.D.: uxe.50500009 Posted: Fri Sep 18 13:08:00 1987 Date-Received: Sun, 20-Sep-87 14:16:58 EDT References: <5117@jade.BERKELEY.EDU> Lines: 39 Nf-ID: #R:jade.BERKELEY.EDU:5117:uxe.cso.uiuc.edu:50500009:000:1555 Nf-From: uxe.cso.uiuc.edu!hirchert Sep 18 12:08:00 1987 /* Written 12:58 am Sep 17, 1987 by lagache@violet.berkeley.edu in uxe.cso.uiuc.edu:comp.lang.fortran */ /* ---------- ""Interesting" error interpretation" ---------- */ ... 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 ^^^^ ----------------------------------------------> ???? <--------- ... /* End of text from uxe.cso.uiuc.edu:comp.lang.fortran */ I don't know about f77 specifically, but a number of Fortran processors make an initial scan of a statement to remove blanks and determine what kind of statement it is and then do the parse based on that knowledge. Since the erroneous combination of the READ statement and the assignment statement has an equal sign not contained in parentheses, the scan apparently decided that the combined statement was an assignment statement, which made READ the variable being assigned to. It might be better if the compiler discarded symbol table information extracted from statements that don't parse correctly, but this can't really be called a bug. Kurt W. Hirchert National Center for Supercomputing Applications University of Illinois