This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/442: atof can give incorrect output
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/442: atof can give incorrect output
- From: lrwayne at earthlink dot net
- Date: 3 Aug 2000 07:21:38 -0000
- Reply-To: lrwayne at earthlink dot net
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, lrwayne@earthlink.net
>Number: 442
>Category: c
>Synopsis: atof can give incorrect output
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 03 00:26:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Len Wayne
>Release: egcs-2.91.66
>Organization:
>Environment:
i686 running Red Hat 6.1 Linux
>Description:
If <stdlib.h> is not included in a program,
then a call to atof should fail. Instead,
atof returns some output, and that output
is incorrect. For example, this program allows
atof to run, but atof returns an incorrect
value (something other than 4.4):
-----------------------------------------
int main () {
printf("%f\n",atof("4.4"));
}
-----------------------------------------
I'm compiling with the command: gcc foo.c
I'm not a good enough programmer to figure
out what library contains the (apparently
bogus) version of atof that is being
accessed by this program, but it certainly
seems like this program should fail to
compile if <stdlib.h> is not included,
rather than return incorrect results.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: