Subject: Nasty problem in atof/strtod
From: [email-masked] (Mumit Khan)

15 Nov 1996 00:02:04 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: [email-masked]
Original-Sender: [email-masked]

The following makes strtod choke and die with very little persuasion!

    #include <stdlib.h>
    #include <stdio.h>

    int main() {
	double val = atof("2.60788366e-20");
	printf ("val = %f\n", val);
	return 0;
    }

    % gcc -g -o atofbug.exe atofbug.c -Wall
    % gdb atof
    (gdb) run
    Program received signal SIGSEGV, Segmentation fault.
    0x781804 in ?? ()
    (gdb) where
    #0  0x781804 in ?? ()
    #1  0x1001baf8 in strtod (s00=0x401014 "-2.60788336e-20", se=0x0)
	at /sethra/death/noer/beta16/src/newlib/libc/stdlib/strtod.c:717
    #2  0x10016ad9 in atof (s=0x401014 "-2.60788336e-20")
	at /sethra/death/noer/beta16/src/newlib/libc/stdlib/atof.c:71
    #3  0x401045 in main () at atof.c:5
    #4  0x10001ebb in dll_crt0_1 (uptr=0x402000)
	at /sethra/death/noer/beta16/src/winsup/dcrt0.cc:520
    #5  0x10001ecf in dll_crt0 (uptr=0x402000)
	at /sethra/death/noer/beta16/src/winsup/dcrt0.cc:532
    #6  0x40111c in cygwin_crt0 ()
	at /sethra/death/noer/beta16/src/winsup/libccrt0.cc:89

btw, works fine for e-19, but e-20 is the breaking point.

Came across this while fighting to make g77 0.5.18 work correctly with
B16. Only took 5 hours to narrow it down to 4 lines of code :-)

Anyone else run across this? I'm using a cross-compiler hosted on my
RH 4.0 i486-linux box, but this particular example was built with
B16 binary distribution, so should be independent of any screwup in
my local config.

regards,
Mumit -- [email-masked]
http://www.xraylith.wisc.edu/~khan
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".