Date: Tue, 1 Oct 2002 13:21:01 -0700 (PDT) From: Archie Cobbs <archie@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: alpha/43567: strtod() core dumps Message-ID: <200210012021.g91KL1Ec032894@beast.freebsd.org>
index | next in thread | raw e-mail
>Number: 43567
>Category: alpha
>Synopsis: strtod() core dumps
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-alpha
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Oct 01 13:30:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Archie Cobbs
>Release: FreeBSD 5.0-CURRENT alpha
>Organization:
Packet Design
>Environment:
System: FreeBSD beast.freebsd.org 5.0-CURRENT FreeBSD 5.0-CURRENT #32: Mon Sep 23 14:10:02 PDT 2002 peter@beast.freebsd.org:/usr/src/sys/alpha/compile/BEAST alpha
>Description:
The strtod() function barfs when given certain inputs.
>How-To-Repeat:
Compile this program and run the commands below:
----------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <errno.h>
#include <err.h>
#define INPUT "5e-324"
int
main(int ac, char **av)
{
const char *ascii = INPUT;
double value;
switch (ac) {
case 1:
break;
case 2:
ascii = av[1];
break;
default:
errx(1, "usage: strtod-test [string]");
}
printf("input is \"%s\"\n", ascii);
printf("result: ");
/* Parse double value */
errno = 0;
value = strtod(ascii, NULL);
if (errno == ERANGE) {
if (value == 0.0) {
printf("underflow\n");
return (0);
}
if (value == HUGE_VAL || value == -HUGE_VAL) {
printf("overflow\n");
return (0);
}
}
printf("value is %g\n", value);
return (0);
}
----------------------------------------------------------------------
$ cc -Wall -o xx xx.c
$ ./xx 5e-304
input is "5e-304"
Floating exception (core dumped)
>Fix:
?
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210012021.g91KL1Ec032894>
