kaul@icarus.eng.ohio-state.edu (Rich Kaul) (04/04/89)
I've been given the dubious honor of porting some rather awful FORTRAN code that someone wrote for our Suns to the HP300s we have around here. My question involves how a particular instruction should behave. The code I have to port has lots of loops like: IF (I.EQ.J) GOTO 1000 ... DO 1000 K=1,77 ... 1000 CONTINUE My question is, how should this behave? I don't think this is good FORTRAN (I already told you my opinion of the code), but it's been quite a while since I've done any serious FORTRAN hacking. The Sun f77 compiler takes this construction happily, but the HP compiler complains loudly and dies. -rich -=- Rich Kaul | Richard Daley, Jr. is the front runner The Ohio State University | for mayor of Chicago. If recent history 2015 Neil Ave, Columbus, OH 43210 | is a guide, he will at least get his kaul@icarus.eng.ohio-state.edu | father's vote.
bruno@hpfcdc.HP.COM (Bruno Melli) (04/04/89)
>The code I have to port has lots of loops like: > IF (I.EQ.J) GOTO 1000 > ... > DO 1000 K=1,77 > ... > 1000 CONTINUE >My question is, how should this behave? Strictly fortran 77 speaking: Section 11.10.1 (ANSI F77 std): The range of a DO-loop consists of all of the executable statements ... including the terminal statement of the DO-loop. Section 11.10.8: Transfer of control into the range of a DO-loop from outside the range is not permitted. However you can use the +e option to turn on Vax compatibility mode and the compiler will let you jump into the loop. The generated code will behave the same way as the executable generated on the sun. You will loop for 77 times. (Assuming that K was 0)
bobm@hpfcmr.HP.COM (Bob Montgomery) (04/04/89)
> I've been given the dubious honor ... > The code I have to port has lots of loops like: > IF (I.EQ.J) GOTO 1000 > ... > DO 1000 K=1,77 > ... > 1000 CONTINUE > >My question is, how should this behave? ... The Sun f77 compiler >takes this construction happily, but the HP compiler complains loudly >and dies. The HP Series 300 FORTRAN compiler accepts options to allow certain FORTRAN extensions from other implementations of FORTRAN. The one you need is '+E0'. According to my FORTRAN/9000 Reference for HP 9000 Series 300 Computers: +E0 Enables extended range DO loops and unstructured jumps into IF blocks. Turns off all register allocation. Using +E0 on a test program based on your example changes the error to a warning and causes the test program to behave the same on my HP350 as it does on a Sun 4/260 running SunOS Release 4.0. Bob Montgomery Hewlett-Packard