delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/03/18:47:38

Xref: news2.mv.net comp.os.msdos.djgpp:3401
From: richard DOT young AT crc DOT doc DOT ca (Richard Young)
Newsgroups: comp.os.msdos.djgpp
Subject: libm.a/linker *BUG* with test program
Date: 2 May 1996 20:59:55 GMT
Organization: Communications Research Centre
Lines: 74
Message-ID: <4mb7ob$3lf@crc-news.doc.ca>
NNTP-Posting-Host: yaker.vpcs.doc.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I've discovered the following incorrect behavior with DJGPP version 2.
The included test program illustrates the symptom of the behavior which
seems to be as a result of including the math library.  When I don't
include libm.a the program does not crash.  When I include libm.a the
program crashes on the 3rd pow() call.  It seems that it also is related
to calling ldexp() too since just calling pow() many times works fine.

Furthermore, when I run another program (gcc, symify etc.) immediately
after running the crashing test program then the other program bombs
with a SIGFPE exit as well.  Invoking the other program once more
returns it to correct operation.

My execution platform is Windows 95 on a Pentium with 80 MB RAM.

I can't use V2 until this issue is resolved.  Thanks in advance.

Richard Young
Communications Research Centre,
Ottawa, Canada
richard DOT young AT crc DOT doc DOT ca


-----------------------------------------------------------
// The test program.

#include <stdio.h>
#include <math.h>

int main()
{
   double m;
   m = ldexp(1.0,6);
   printf("y=%f\n",pow(10.0,4.0));
   m = ldexp(1.0,6);
   printf("y=%f\n",pow(10.0,4.0));
   m = ldexp(1.0,6);
   printf("y=%f\n",pow(10.0,4.0));
}

-----------------------------------------------------------

compiled with

gcc -o test test.cpp -lm

generates the following output

y=10000.000000
y=10000.000000
Exiting due to signal SIGFPE
Floating Point exception at eip=00001e47
eax=40060000 ebx=00000001 ecx=0000a2b8 edx=00040000 esi=00000003 
edi=0000d8c0
ebp=0004d858 esp=0004d7cc cs=00a7 ds=00af es=00af fs=0087 gs=00c7 ss=00af
Call frame traceback EIPs:
  0x00001e47
  0x000016af
  0x000015f0
  0x00003c4f

-----------------------------------------------------------

compiled with

gcc -o test test.cpp

generates the following output

y=10000.000000
y=10000.000000
y=10000.000000



- Raw text -


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