ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/09/22/10:41:56

Date: Tue, 22 Sep 1992 16:03:33 +0200
From: Dirk Zabel <dzabel AT cs DOT tu-berlin DOT de>
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019