delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/06/01:14:58

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: 387 emulation problem
Date: Tue, 05 Oct 1999 18:55:34 -0700
Organization: Harvey Mudd College
Lines: 47
Message-ID: <37FAAC16.BC93B80D@hmc.edu>
References: <7skr62$7ff AT fingers DOT shocking DOT com> <7tcd6r$gvh AT fingers DOT shocking DOT com>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 939174977 14802 134.173.45.219 (6 Oct 1999 01:56:17 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 6 Oct 1999 01:56:17 GMT
X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.13pre12 i586)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ralph Reid wrote:
> 
> In article <7skr62$7ff AT fingers DOT shocking DOT com>,
> I <ralph AT fingers DOT shocking DOT com> wrote:
> >
> >The 387 emulation library seems to have a problem.  I compiled the
> >little program below with gcc2.95 and DJGPP, using the following
> >command lines in an MSDOS 6.22 OS on a 486SX25:
> >
> >gcc -s -O2 -Wall -c sqrt.c
> >gcc -s -O2 -Wall -o sqrt.exe sqrt.o -lemu
> >
> >No errors or warnings appear during compilation or linking.  Running
> >the resulting program (SQRT.EXE) produces no output at all, and I was
> >able to terminate the program with CTRL-C.  Here is the program
> >source:
> >
> >==============================cut here==============================
> >
> >/*Demonstrate the EMU387 error.*/
> >
> >#include <math.h>
> >#include <stdio.h>
> >
> >int main (void) {
> >  printf ("%g\n", sqrt (2.0));
> >  return (0);
> >}     /*main*/
> >
> >==============================cut here==============================
> 
> After some email and file exchanging, Eli Zaretskii and I determined
> that this problem was caused by a bug in the emulation library in
> version 2.02 and earlier DJGPP gcc distributions.  The 387 emulation
> library for version 2.03 seems to fix this problem.  I found that
> several of the many functions listed in the math.h header would hang
> with the older emulation library installed, while all of the functions
> produced output once the new library was installed.

Yes.  It was a compiler bug that compiled the emulation for the FSQRT
instruction into an infinite loop.  The CVS version has a workaround (I
submitted it :).

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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