Mail Archives: djgpp/1996/12/05/08:23:56
There seems to be a bug in the exp() function: on my computer,
for certain values it will push an unexpected "-1" in the numerical processor
stack, so coming on calculations will be likely to crash.
I saw that by using FSDB.exe (Full Screen DeBugger from GNU) for PC-MSDOS.
I guess the exp() function is part of the DJGPP package, so I am sending
the report to you.
Thanks in advance.
-------------------------------------
Michel JULIER
Groupe d'Etudes des Semiconducteurs, CC074, place Eugene Bataillon,
34095 Montpellier Cedex 5, FRANCE, tel. +33 4 67 14 32 39
Chez moi/at home/a casa: 13 rue de l'Ecole de Droit,
34000 Montpellier, FRANCE, tel. +33 4 67 92 95 67
The example program follows
---------------------------------
/* This programs fails to run when compiled with gcc -Wall -g test.c -o
test -lm
on a PC - Cyrix P133+ at 110MHz - MSDOS 6.20 + Windows 3.1
I am using DJGPP v2.0 in a MS-DOS Command window
---Transcript of error messages ---
C:\USERS\JULIER>test
Exiting due to signal SIGFPE
Floating Point exception at eip=00001e35
eax=00000002 ebx=000500c0 ecx=0005304c edx=00000033 esi=00000054 edi=0000dec0
ebp=0004de98 esp=0004de18 cs=00af ds=00b7 fs=0087 gs=00c7 ss=00b7
Call frame traceback EIPs:
0x00001e35 (_main+2293, line 52 of test.c) [see "ERROR HAPPENS HERE"]
0x00004213 (___crt1_startup+115)
C:\USERS\JULIER>symify test
Exiting due to signal SIGFPE
Floating Point exception at eip=000057f2
eax=00000000 ebx=00000000 ecx=0005404c edx=00000033 esi=0004f3a8 edi=0000f5e0
ebp=0004f5c4 esp=0004f3a8 cs=00af ds=00b7 fs=0087 gs=00c7 ss=00b7
Call frame traceback EIPs:
0x000057f2 (_realloc+126)
0x000039ba (___kernal_standard+3788)
C:\USERS\JULIER>symify test
C:\USERS\JULIER>_
*/
#include <stdio.h>
#include <math.h>
#define chose(a,b) ((a)+(b))/((a)-(b))
#define chose2(a,b) chose(((a)*(b)),((a)/(b)))
#define chose3(a,b) chose2(((a)*(b)),((a)/(b)))
#define chose4(a,b) chose3(((a)*(b)),((a)/(b)))
#define chose5(a,b) chose4(((a)*(b)),((a)/(b)))
#define chose6(a,b) chose5(((a)*(b)),((a)/(b)))
#define chose7(a,b) chose6(((a)*(b)),((a)/(b)))
#define chose8(a,b) chose7(((a)*(b)),((a)/(b)))
#define chose9(a,b) chose8(((a)*(b)),((a)/(b)))
void main(){
double a,b;
double x=1.1,y=1.2;
a=-0.482636;
b=exp(a); /* This produces a remaining -1 in the numerical processor stack */
/* No problem any more if you remove this line */
b=chose9(x,y); /* ERROR HAPPENS HERE:
This will try to use all the stack for the calculation. */
printf("%g\n",b);
}
- Raw text -