This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug translation/15483] New: gcc lexes hexadecimal floating-point constants incorrectly
- From: "das at FreeBSD dot ORG" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 May 2004 00:35:58 -0000
- Subject: [Bug translation/15483] New: gcc lexes hexadecimal floating-point constants incorrectly
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Below is a demonstration of two bugs. The first is a lexer bug,
and the second is in real_from_string(), and probably fixable
with the following change to real.c:
< if (str[0] == '0' && str[1] == 'x')
> if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
das@VARK:~> gcc --version
gcc (GCC) 3.3.3 [FreeBSD] 20031106
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
das@VARK:~> echo "double x = 0x.1p3;" > f.c
das@VARK:~> gcc f.c -Wall
f.c:1:12: invalid suffix "x.1p3" on integer constant <--- BUG
das@VARK:~> cat > g.c
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("%e\n", 0X0.5p2);
return (0);
}
das@VARK:~> gcc g.c -Wall
das@VARK:~> ./a.out
0.000000e+00 <--- BUG
--
Summary: gcc lexes hexadecimal floating-point constants
incorrectly
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: translation
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: das at FreeBSD dot ORG
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15483