Strange Behavior -- AT&T Std C
Peter J. Holsberg
pjh at mccc.edu
Fri Apr 19 00:47:59 AEST 1991
Here's the source:
#include <stdio.h>
#include <math.h>
void main()
{
printf("Exp(0) = %f\n", exp(0.0));
printf("Exp(1) = %f\n", exp(1.0));
printf("Exp(-1) = %f\n", exp(-1.0));
}
Here's a typescript of the compilation, execution, and debugging runs:
Script is typescript, started Thu Apr 18 10:41:28 1991
mccc [pjh] /usr/pjh/c> cc -g -o y y.c -lm
mccc [pjh] /usr/pjh/c> y
Floating exception(coredump)
mccc [pjh] /usr/pjh/c> sdb y
no source file WHY DOES SDB SAY THIS????
0x2cc (exp+368:) ffree %st(5) [ %st(5) ]
*r
./y
SIGNALED 8 process 4444
0x2cc (exp+368:) ffree %st(5) [ %st(5) ]
*s
SIGNALED 8 process 4444
0x2ce (exp+370:) popl %edi [ %edi ]
*s
STEPPED process 4444 function main() in y.c
6: printf("Exp(1) = %f\n", exp(1.0));
*s
STEPPED process 4444 function main() in y.c
7: printf("Exp(-1) = %f\n", exp(-1.0));
*s
SIGNALED 8 process 4444
0x2ce (exp+370:) popl %edi [ %edi ]
*s
STEPPED process 4444 function main() in y.c
7: printf("Exp(-1) = %f\n", exp(-1.0));
*s
STEPPED process 4444 function main() in y.c
8: }
*s
Exp(0) = 1.000000
Exp(1) = 2.718282
Exp(-1) = 0.367879 GOOD LORD! IT DID THE CALCULATIONS!!
Process 4444 has terminated.
*s
Can't step process, it's a core file.
*q
mccc [pjh] /usr/pjh/c>
Script done Thu Apr 18 10:42:23 1991
This was done, incidentally, both with the original libm.a (that I was
*so* sure was buggy!) and a borrowed copy of a later version of libm.a!!
What on earth can be causing the "Floating exception(coredump)"????
Thanks,
Pete
--
Prof. Peter J. Holsberg Mercer County Community College
Voice: 609-586-4800 Engineering Technology, Computers and Math
UUCP:...!princeton!mccc!pjh 1200 Old Trenton Road, Trenton, NJ 08690
Internet: pjh at mccc.edu Trenton Computer Festival -- 4/20-21/91
More information about the Comp.lang.c
mailing list