printf "%f" error

Michel Benoit murpme at gmail.com
Tue Jun 5 00:46:07 PDT 2007


Hello,

I'm running uClibc 0.9.29 on an arm (AT91SAM9260) target. uClibc is
built with gcc 4.1.2 using buildroot without the soft-float enabled.
My Linux kernel is 2.6.20.4 with NWFPE floating point emulator.

The following code

double fl = 0.0;
printf("%f=%g=%e\n", fl, fl ,fl);

gives the following output

NWFPE: prod[805] takes exception 00000002 at c002c388 from 400a67bc
NWFPE: prod[805] takes exception 00000002 at c002c388 from 400a67bc
NWFPE: prod[805] takes exception 00000002 at c002c388 from 400a67bc
0.000000=0=0.000000e+00

The printf works fine but something is causing a floating point
exception to occur when formatting (rounding perhaps) 0.0.

Exception 00000002 seems to be a divide by zero.
Looking at /proc/805/maps shows that the PC address 400a67bc is in
libuClibc-0.9.29.so.
Using arm-linux-objdump on libuClibc-0.9.29.so seems to point at the
function ftello64() as the culprit.

Any ideas as to the cause of this error?

Michel


More information about the uClibc mailing list