This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translation/15483] New: gcc lexes hexadecimal floating-point constants incorrectly


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]