🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #261

Re: MS Fortran bug

#261
From: Duncan Murdoch
Date: Mon, 20 Nov 1989 02:26
36 lines
1745 bytes
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
Technical Details
Message-ID: <864@maytag.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!watmath!maytag!watstat!dmurdoch
References: <863@maytag.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!watmath!maytag!watstat!dmurdoch
From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch)
Newsgroups: alt.msdos.programmer,comp.sys.ibm.pc,comp.lang.fortran
Subject: Re: MS Fortran bug
Summary: I found the bug, and have a patch
Message-ID: <864@maytag.waterloo.edu>
Date: 20 Nov 89 02:26:32 GMT
References: <863@maytag.waterloo.edu>
Sender: daemon@maytag.waterloo.edu
Reply-To: dmurdoch@watstat.waterloo.edu (Duncan Murdoch)
Organization: U. of Waterloo, Ontario
Lines: 36