[comp.unix.ultrix] Breaking Fortran 2.1

fnddr@acad3.alaska.edu (Rice Don D) (02/05/91)

In compiling some old Fortran programs, I found a quick way to break the
f77-2.1 compiler under Ultrix 4.0:

      type *,'This is an attempt to break the fortran compiler.'
      j = 0
      do 10 i=1,5
         type *,i,j
         if( i .lt. 3 ) goto 10
         do 10 j=1,4
            type *,'l2:',i,j
 10   continue
      stop
      end

Granted it is a no-no by modern standards, but this structure seems to be
pretty popular in pre-f77 Fortran programs, which I have a lot of.
It compiles without any warnings, and when run it goes into an infinite loop
with strange values for j.  It doesn't go away when optimization is turned off.
It is really fun when this sort of structure is buried in a large numerical
program...it compiles fine, but goes nuts when it runs.

Hopefully this is moot since there is an all-new f77-3.0 promised.  But I've
heard several people complain that their trusty old Fortran codes simply will
not run correctly on DECstations, and now I see one of the reasons.

Just thought you'd like to know...

Don Rice                                  Internet: ddr@flux.gi.alaska.edu
Geophysical Institute                     E-mail:   fnddr@alaska.bitnet
University of Alaska                      Phone:    (907) 474-7569
Fairbanks, AK 99775                       Loran:    64.86N 212.16E