Bug in Float.valueOf(String)
Archie Cobbs
archie at whistle.com
Mon Jan 25 13:24:37 PST 1999
Alexandre Oliva writes:
> >> /* Floats are passed as doubles in C!!!!!
> >> obj = (struct
> >> Hjava_lang_Float*)execute_java_constructor("java.lang.Float", 0, "(F)V",
> >> (float)java_lang_Double_valueOf0(str));
>
> > I don't understand.. what's the problem? Are you just complaining about
> > the loss of precision, or something worse?
>
> It's much worse, and it's a problem of Kaffe I have reported to Tim
> Wilkinson and documented in release 1.1 (or maybe 1.2) of Guaraná. In
> C, floats are promoted to doubles in ellipsis arguments, but Kaffe JIT
> generates code to read a float from the stack, not a double.
> Therefore, the constructor ends up picking the wrong value out of the
> stack. The problem also affects return values, if my memory serves.
I thought that in ANSI C if you cast a function argument, it would
not be promoted.. hmm, let me read the book..
Ah yes you are right .. in the case of elipsis arguments, the default
"old style" promotions do occur. I'll commit your fix.
Do you have any other known examples of this bug?
Thanks,
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
More information about the kaffe
mailing list