This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [MIPS32] Can't get printf to work with %f && %lld
Oups, sorry. Too much copy and paste, I guess, and I squeezed the most
important part :)
Well, the main behavior is that printf() prints out either 0 or an
obnoxious value (a float number > 10^15 composed of random digits).
Nothing obvious. You haven't mentioned what the failures are.
You'll have to try debugging it. Follow inside vfprintf.c and see
where it goes. Making sure that gcc is passing things properly on
the var arg list is one thing to look for.
Well, I've noticed weird behaviors concerning the variadic arguments
handling in gcc4 for MIPS, especially when the function manipulating
the va_list is inlined and long long values are involved :( I've a
test case that I still need to send to gcc-bug. I believe the two
problems are linked.
If you don't include <stdio.h> for your test, the compiler can get
things totally wrong as it doesn't put things on the var arg list
correctly. Another thing to look for is that newlib understands the
format of your floating-point properly (see libc/stdlib/mprec.h).
When you enable long double support, you get _ldtoa_r being called
from printf. If you remove that enablement, you can see if newlib
can get simple doubles working correctly using _dtoa_r instead.
I'll try to build a version without the long double support, and see
if I can repeat the same behavior.
Note that normal mips platforms set the -DMISSING_SYSCALL_NAMES flag
in configure.host
and unless you add your configuration type there, this won't happen.
This probably answer a long lasting question about when '_' should be
added to the syscall names or not :) I'll add it to my configuration.
Kind regards,
Xavier
-----
Xavier Guérin - Doctoral student
TIMA Laboratory, SLS Group
46, av. Félix Viallet, 38000 GRENOBLE, FR
Mail : xavier.guerin@imag.fr
Phone : +33(0)4 76 57 47 59
Ad Astra Per Aspera
Triste e' quel discepolo che non avanza il suo maestro