Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!katzo.rice.edu!zdenko From: zdenko@katzo.rice.edu (zdenko tomasic) Newsgroups: comp.sys.mips Subject: Re: f77 compiler bug (both MIPS and SGI) Summary: a program bug, not compiler one Message-ID: <1991Jun17.224729.15190@rice.edu> Date: 17 Jun 91 22:47:29 GMT References: <1991Jun17.174155.13484@cpsc.ucalgary.ca> Sender: news@rice.edu (News) Organization: Rice University Lines: 58 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. > >From the above, if the 'if' evaluates to TRUE, then the following code, >including the DO loop are supposed to be skipped. This doesn't happen >under MIPS-fortran. Instead, the loop-code is executed using a value >of "whatever" for the control loop variable. Now (personally) I don't >see that as a compiler bug, more a case of antequated coding style. >(ie. the purpose of the '10 continue' becomes ambigous). Anyway, I thought >I would post this in case others are suffering program failures for the >same or similiar reason. BTW : the fix to the above is of the form : > > > if (...) goto 11 > . > . > . > do 10 .... > . > . > . > 10 continue > 11 continue > The above is most likely the proper fix for the program bug. >ttfn > >-- >Cliff Marcellus | Internet : cliff@phys.ucalgary.ca >Department of Physics and Astronomy | SPAN : CANCAL::CLIFF >The University of Calgary >OPINIONS EXPRESSED WITHIN ARE MY OWN AND NOT THOSE OF THE UNIVERSITY OF CALGARY -- ___________________________________________________________________ Zdenko Tomasic, Rice U., Chem. Dept., P.O. Box 1892, Houston, Tx 77251 INTERNET: zdenko@katzo.rice.edu ___________________________________________________________________