strange floating point problem

Segher Boessenkool segher@kernel.crashing.org
Thu Feb 22 19:28:00 GMT 2007


> What results do you get if your printf format specifiers match the 
> actual
> data type being passed in...
>
> double - %lf

Plain %f means double, too -- all "float" are
promoted to "double" when passed to a varargs
function.

> unsigned long - %lu or %lx

Doesn't matter on his platform (ARM); although
of course it _is_ incorrect to say %x instead
of %lx, it doesn't change the result.

It looks like there is a bug in the soft float
library.  Harald, look at the generated assembler
code (compile with -S instead of -c) to find out
what's going on, to see why -O3 works.


Segher



More information about the Gcc-help mailing list