Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!aunro!alberta!cpsc.ucalgary.ca!wesson!cliff From: cliff@wesson.phys.ucalgary.ca (Cliff Marcellus) Newsgroups: comp.sys.mips Subject: Re: f77 compiler bug (both MIPS and SGI) Message-ID: <1991Jun19.133207.24629@cpsc.ucalgary.ca> Date: 19 Jun 91 13:32:07 GMT References: <1991Jun17.174155.13484@cpsc.ucalgary.ca> <1991Jun17.224729.15190@rice.edu> <1991Jun18.191622.4008@odin.corp.sgi.com> Reply-To: cliff@phys.ucalgary.ca Organization: Institute for Space Research Lines: 34 In article <1991Jun18.191622.4008@odin.corp.sgi.com>, calvin@dinkum.wpd.sgi.com (Calvin H. Vu) writes: |> In <1991Jun17.224729.15190@rice.edu> zdenko@katzo.rice.edu (zdenko tomasic) writes: |> |> | In article <1991Jun17.174155.13484@cpsc.ucalgary.ca> cliff@phys.ucalgary.ca writes: |> | >I've discovered an interesting 'glitch' in the f77 compiler for |> | >MIPS (and consequently, for SGI, also). given a code skeleton of : |> | > |> | > if (...) goto 10 |> | ^^ jump into the body of the loop from outside! |> | (the continue statement is a part of the loop) |> | > . |> | > do 10 .... |> | > . |> | >10 continue |> | ^^ |> | This jump is illegal fortran, so anything can happen at the execution time. Many thanks to all that pointed out that jumping into a loop is illegal. But strictly speaking, the above is not illegal. Older f77 compilers understood that this meant to skip over the code from the 'if' to the '10 continue'. (example: the 4.3BSD (circa '87) compiler handles this code just fine and produces the *correct* results. Anyway, it really just a look into the past (f66) since it is bad coding style! {-8 |> |> This is illegal and I have fixed it to give an error message when |> it happens. Later I changed the error into a warning since some people |> may want to control the unpredictability of their program execution |> rather than to do things the right and predictable way. It will be |> in SGI's 4.0 release. |> Super! BTW : the MIPS (and SGI??) V2.11 compilers missed this anomaly. I recently tried the MIPS V2.20 f77 and it flags this as a fatal error...