Article View: gnu.gcc.bug
Article #6123bug in exp() in JDGPP v2.0
From: Michel Julier
Date: Thu, 05 Dec 1996 00:00
Date: Thu, 05 Dec 1996 00:00
73 lines
3141 bytes
3141 bytes
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 for PC-MSDOS
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);
}
Technical Details
Message-ID:
<1.5.4.16.19961205115350.1df7aaf4@um2gess0.ges.univ-montp2.fr>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,7706f8a9cf1083fc,start X-Google-Attributes: gid113d02,public From: julier@GES.univ-montp2.fr (Michel Julier) Subject: bug in exp() in JDGPP v2.0 Date: 1996/12/05 Message-ID: <1.5.4.16.19961205115350.1df7aaf4@um2gess0.ges.univ-montp2.fr> X-Deja-AN: 202478359 sender: bug-gcc-request@prep.ai.mit.edu x-sender: julier@um2gess0.ges.univ-montp2.fr content-type: text/plain; charset="us-ascii" x-gateway: relay4.UU.NET from bug-gcc to gnu.gcc.bug; Thu, 5 Dec 1996 05:54:39 EST mime-version: 1.0 newsgroups: gnu.gcc.bug x-mailer: Windows Eudora Light Version 1.5.4 (16)