This is the mail archive of the gcc@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]

Re: gcc not recognizing all C99 hex float constants


Michael Matz wrote:-

> Hi,
> 
> I noticed, that even in C99 mode gcc doesn't recognize all hexadecimal
> floating point constants.
> 
> Compile this with "gcc -std=c99":
> 
>   float f = 0x.9p0;
> 
> this gives the error
>   ppnumber.c:1:11: invalid suffix "x.9p0" on integer constant
> 
> This is because cppexp.c:cpp_classify_number() only wants to go to base 16
> (after it sees "0x"), if the following char is a hex digit (i.e. it
> doesn't like the '.').

Well spotted.
 
> 6.4.4.2 explicitely mentions, that for a 'hexadecimal-fractional-constant'
> the initial 'hexadecimal-digit-sequence' before '.' is optional.

Could you do the obvious patch (+ testcase)?  I can do it, but you'll
have to wait a few days.

Neil.


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