Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uwm.edu!ogicse!uidaho!tamaluit!pbickers From: pbickers@tamaluit.phys.uidaho.edu (Paul Bickerstaff) Newsgroups: comp.sys.mips Subject: Re: f77 compiler bug (both MIPS and SGI) Message-ID: <1991Jun20.075058.10576@groucho> Date: 20 Jun 91 07:50:58 GMT Article-I.D.: groucho.1991Jun20.075058.10576 References: <1991Jun19.162129.2870@batcomputer.tn.cornell.edu> <1991Jun17.224729.15190@rice.edu> <1991Jun18.191622.4008@odin.corp.sgi.com> <1991Jun19.133207.24629@cpsc.ucalgary.ca> Sender: @groucho Reply-To: pbickers@tamaluit.phys.uidaho.edu (Paul Bickerstaff) Organization: physics dept Lines: 93 Nntp-Posting-Host: tamaluit.phys.uidaho.edu In article <1991Jun19.162129.2870@batcomputer.tn.cornell.edu>, riley@theory.TC.Cornell.EDU (Daniel S. Riley) writes: > In article <1991Jun19.133207.24629@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 > >>> . > >>> do 10 .... > >>> . > >>>10 continue > > > Just because some compiler accepts it and does what you want does > not mean that it is legal code. To quote chapter and verse, from > ANSI X3.9-1978 (FORTRAN 77), > This is all very well but I would like to point out that Mips does market their Fortran compiler as VMS fortran compatible and this is a *big* selling point. I don't know any physicist who would go out of their way to buy an ansi f77 compiler. In our case for example, when we were evaluating workstations, we essentially vetoed HP on account of their fortran compiler. (The 800 series one I considered particularly fussy.) Why is this important? I don't want to start a flame war (I was brought up on Burroughs Algol and am simply stating facts not personal preferences) but in physics the major programming language is fortran. It has always been and always will be (as far as I can see). Many of us have huge codes written in Fortran which work on other machines (until recently Vaxen were very popular in physics but IBM and others can be included as machines on which this code runs). Nobody wants to suffer major hassles porting these programs to other platforms. I have seen major labs veer away from certain workstation vendors because of the perceived difficulty in getting existing programs to compile on their product. Also physicists collaborate a lot, exchanging programs and visiting collaborators. Nobody wants to spend half of their visit with their collaborator debugging their programs all over again. The Mips compiler has a lot of useful flags for those who believe fortran is defined by past usage and not some self-appointed expert from ansi e.g. -static is a godsend for many users here; -r8 is also very useful for those moving from a Cray with it's default double precision. Mips also offer a flag for those who want to check that their code conforms to standards. Hence I would like to advocate that Mips adopt the philosophy that their compiler should compile code like that in the above example, perhaps with a warning or perhaps only if some flag is set, but it should be possible to compile the program **and correctly execute it** without rewriting it. (Could there ever be any problem with jumping to a continue statement at the end of a do loop?) If Mips do not want to adopt this philosophy then they should stop marketing their compiler as VMS compatible. (I am aware that there are some incompatibilities acknowledged by Mips but for the most part they are rather arcane.) Now to finish with a couple of technical examples of standards gone crazy: 1) Very similar, if not identical, to the one above. We had a visitor from Germany whose program ran on a Vax, an IBM and a Convex (and probably a Cray) but our Mips spewed garbage. The problem was traced to a construct like do 10 ... ... if (...) goto 10 do 10 ... ... 10 continue The use of a single continue as the last statement in overlapping do loops is apparently allowed -- the Mips fortran manual says so -- but as above the goto failed. (I may not have recalled the exact construction but there was no compiler error, just wrong results.) Using two distinct continue statements cured this guy's problem. Not hard to fix you may say but a waste of much time surely. 2)There is an obscure rule in f77 which requires that data statements come after declarations and before the other program statements. Most compilers don't require this (and I have a suspicion that earlier versions of the Mips compiler did not either or we probably would not have bought a Mips) but somebody in their wisdom has decided that the Mips compiler will conform with the standard. Please, how about a flag that will let this pass. Paul Bickerstaff Internet: pbickers@tamaluit.phys.uidaho.edu Physics Dept., Univ. of Idaho Phone: (208) 885 6809 Moscow ID 83843, USA FAX: (208) 885 6173