home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
utility
/
tpfortra
/
fortran.bug
< prev
next >
Wrap
Text File
|
1989-11-19
|
1KB
|
39 lines
When I tested TPFORT on my XT clone machine, I found that it regularly
crashed. I spent several hours trying to see what I was doing wrong, but it
turned out to be a bug in the Fortran 5.0 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. I believe it works on a 287 or 387
because the FSTCW completes even without any following delay.
Duncan Murdoch