This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53095] New: std=gnu99 atof x86
- From: "JoaquinMonleon at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Apr 2012 20:40:38 +0000
- Subject: [Bug c/53095] New: std=gnu99 atof x86
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53095
Bug #: 53095
Summary: std=gnu99 atof x86
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: JoaquinMonleon@gmail.com
Created attachment 27227
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27227
the preprocessed file (*.i*) that triggers the bug
/*
Exact version of GCC: That I know that version 4.3, 4.6 and 4.7 has this bug.
System Type: x86_32, i686, 32BITS Intel architecture. It don't occurs in 64 bit
intel architectures.
Options given when GCC was configured/build: The error happen when you use
-std=gnu99 ÂÂBY DEFAULT :O!! standar or -std=gnu89, but not when you use other
standar like -std=c99
The complete command line that triggers the bug: "gcc main.c -o main"
The compiler output (error messages, warnings, etc.): None.
the preprocessed file (*.i*) that triggers the bug, generated by adding
-save-temps to the complete compilation command, or, in the case of a bug
report for the GNAT front end, a complete set of source files (see below): As
attachment
Thank's I love GNU & your work a million of thanks.
*/
#include <stdio.h>
#include <stdlib.h>
int main(){
char *cadena = "-25.9";
//USING A TEMP VARIABLE
double d = atof(cadena) * 10;
short s1 = (short) d;
printf("%d\n",s1); //I GET -259
//WITHOUT A TEMP VARIABLE
short s2 = atof(cadena) * 10;
printf("%d\n",s2); //I GET -258????????????????????????????? WTF?
}