Date: Tue, 22 Sep 1992 16:03:33 +0200 From: Dirk Zabel To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: sqrt-problem Ok, finally I found the reason, why the sqrt-function from D.J. Delories 387-Emulator crashes. I have no idea, why I needed that long to see such an obvious bug :-( . Of course this does solve the problem, why the g++ compiler emits incorrect code for the original statement which was commented out. patch: -------- cut here ------ cut here ------ *** e17.cc Wed Apr 8 20:45:16 1992 --- e17new.cc Tue Sep 22 14:42:38 1992 *************** *** 122,128 **** while (!(((long *)&result)[1] & 0x80000000)) { /* left = (left << 2) + (val >> 62); */ ! left = (left << 2) + (((unsigned *)val)[1] >> 30); djshld(&val); djshld(&val); if (left >= side*2 + 1) --- 122,129 ---- while (!(((long *)&result)[1] & 0x80000000)) { /* left = (left << 2) + (val >> 62); */ ! // left = (left << 2) + (((unsigned *) val)[1] >> 30); ! left = (left << 2) + (((unsigned *)&val)[1] >> 30); djshld(&val); djshld(&val); if (left >= side*2 + 1) -------- cut here ------ cut here ------ Thank you to all who gave helpful messages & hints. -- Dirk