A possible bug in parsing floating point numbers.

tm tm@kloo.net
Thu Apr 4 23:56:00 GMT 2002


Zack Weinberg wrote:
> 
> On Tue, Apr 02, 2002 at 01:29:21AM -0800, Kazu Hirata wrote:
> >
> > The first patch breaks the build of the h8300 port during compilation
> > of libgcc2.c.  With the second patch, the h8300 port builds again, but
> > I get ".long 0" in an assembly output for any floating point constant.
> > Since you seem to have done some cleanup/fix on the lexical analysis
> > of floating point numbers, I am wondering if you could give me some
> > insight into this problem.  Here is what's happening.
> 
> Please try this patch.

I sent mail earlier today about this, but it didn't show up on the list,
so I'm assuming
it was lost somehow.

Basically, with this patch, the single-precision floats are still
encoded incorrectly.
I get encodings of 0x3f800001 and 0x3f800002 for 1.0f depending on
whether it's stored statically in a variable or passed as a parameter.

For example:

static float a = 1.0f;

winds up with the value initialized to 0x3f800001.

The correct value for 1.0f is 0x3f800000.

Toshi



More information about the Gcc-bugs mailing list