Date: Thu, 23 Feb 1995 09:40:13 +0100 From: ttgrx AT win DOT tue DOT nl (Erwin Kok) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: strange fp exception > I'm running dj112 maint4 and a program that used to work under MSC (NT/WIN95) > and which I ported back to DGJPP/GRX suddenly has problems for > a reason I don't understand: > > go32 version 1.12.maint3 Copyright (C) 1994 DJ Delorie > 236340+20480+217724 = 474544 > 412 Kb conventional, 1024 Kb expanded - 1436 Kb total RAM available > eax=00000c7a ebx=00068e1c ecx=0003fbdc edx=00000000 > esi=00000000 edi=00000000 ebp=7ffffda4 RF UP IE PL NZ PE NC > ds=0048 es=0048 fs=0048 gs=0038 ss:esp=0048:7ffffd20 cs=00d8 > Numeric Exception (invalid operation) at eip=0x00001780 > 00001780: db5d88 fistp [ebp-120] > 00001783: d96de0 fldcw [ebp-32] mebp=7ffffda4 > where > 0x00001783 _vci_, line 606 in file vci.c > 0x0000bb83 _dline2_, line 3263 in file vci.c > 0x000004e4 _MAIN__+770 > 0x0002b7f5 _main+177 > > And line 606 has the following: > > points[i].y = window.y_size - (int) realout[i]; > > I can only suspect that the cast (int) could cause the problem. > All variables are int in that assignment. > A while ago I had a similar fp-exception: I made up a program compiled it and it worked (under DJGPP FPU-emulation), but when I bought a co-processor, I compiled it and a strange floating-point exception appeared... After a few debugging hours I found that the result from an arithmetic statement was NAN (Not A Number), and when you do another statement with a NAN an exception appears. So, the FPU-emulator under DJGPP didn't had a problem with a NAN it runned right through it. But the real FPU didn't except the NAN and gave an exception. So maybe MSC ran through some NAN and when you ported it to DJGPP/GRX the exception appeared. My advise is check if any variabeles are NAN's. ( I hope this will help you in solving the fp problem :-) ) Cheers, Erwin.