[comp.sys.hp] INFINITE LOOP

edwards@qtp.ufl.edu (W. Dan Edwards) (03/13/90)

Why does this Fortran program crash and burn on my 9000/350?

      write(6,600) secnds(0.0)
      open(unit=1, file= 'trash')
      stop
  600 format(f10.2)
      end

It runs fine if you write one record on unit=1!
(Needs the +E1 option on the f77 command)

Daniel Edwards \\ Department of Chemistry \\ University of Idaho \\
Moscow, IDAHO 83843 \\ (208) 885-6552 \\ edwards@neon.chem.uidaho.edu

cunniff@hpfcso.HP.COM (Ross Cunniff) (03/14/90)

In article <947@orange.qtp.ufl.edu> edwards@qtp.ufl.edu (W. Dan Edwards)
writes:

>Why does this Fortran program crash and burn on my 9000/350?
>
>      write(6,600) secnds(0.0)
>      open(unit=1, file= 'trash')
>      stop
>  600 format(f10.2)
>      end

>It runs fine if you write one record on unit=1!
>(Needs the +E1 option on the f77 command)

This is due to a bug in the libFext exit() subroutine; the bug has
been fixed in the 7.0 release of the FORTRAN compiler.  Note that
the stop indirectly calls the libFext exit() subroutine if +E1 is
used.  If you don't directly call exit() from a FORTRAN subprogram,
you may avoid this problem by doing the following:

	f77 -c *.f
	ld -r *.o -lFext -o intermediate.o
	f77 intermediate.o -o <wherever you want it to go>

This pulls in any compatibility subroutines you might need from
libFext while avoiding pulling in the defective exit() subroutine.

>Daniel Edwards \\ Department of Chemistry \\ University of Idaho \\
>Moscow, IDAHO 83843 \\ (208) 885-6552 \\ edwards@neon.chem.uidaho.edu

				Ross Cunniff
				Hewlett-Packard Colorado Language Lab
				...{ucbvax,hplabs}!hpfcla!cunniff
				cunniff%hpfcrt@hplabs.HP.COM