Xref: utzoo comp.sys.ibm.pc:38495 comp.lang.fortran:2691 alt.msdos.programmer:736 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!br0w+ From: br0w+@andrew.cmu.edu (Bruno W. Repetto) Newsgroups: comp.sys.ibm.pc,comp.lang.fortran,alt.msdos.programmer Subject: Re: MS Fortran bug Message-ID: Date: 20 Nov 89 17:09:34 GMT References: <863@maytag.waterloo.edu>, <864@maytag.waterloo.edu> Organization: Graduate School of Industrial Administration, Carnegie Mellon, Pittsburgh, PA Lines: 55 In-Reply-To: <864@maytag.waterloo.edu> Duncan Murdoch's message regarding a MS Fortran bug: >In article <863@maytag.waterloo.edu> I wrote: >> >>The following little program crashes an XT clone with an 8086/8087. > >It turned out to be a bug in the run-time library routine __init80x87. >It had the sequence > FSTCW [BP-4] > FNINIT > MOV CX,01Eh > LOOP in place >What happens on an 8087 is that the FNINIT aborts the FSTCW instruction, and >the control word never got stored. Later on a garbage control word was loaded >and the system crashed. A fix that seems to work is to put the delay loop >before the FNINIT. I'm not sure what the original programmer would have >been thinking of writing it this way; the next instruction is an arithmetic >one that is preceded by a WAIT anyways. > >To patch the library LLIBFOR7.LIB, search for the original bytes > > 9B D9 7E FC > DB E3 > B9 1E 00 > E2 FE > >and replace them with > > 9B D9 7E FC ; no change > B9 1E 00 ; line 3 above > E2 FE ; line 4 above > DB E3 ; line 2 above > >In my copy of the library the first 6 bytes of the original gave a unique search >string. I'd guess it's safe to do the same patch on any other library; the >original code would never make sense. > >Duncan Murdoch This is all ok, but: what version of MS Fortran are you talking about? Bruno Bruno Wiener Repetto Department of Operations Research Graduate School of Industrial Administration (GSIA) Carnegie-Mellon University Schenley Park Pittsburgh, PA 15213 GSIA Room 8b, x8730 [(412)CMU-8730] br0w+@andrew.cmu.edu