sprintf bugs with floating point and field specifiers?

Jeff Johnston jjohnstn@redhat.com
Wed Sep 6 20:52:00 GMT 2006


Dave Korn wrote:
> On 06 September 2006 00:10, Matt Lee wrote:
> 
> 
>>I am seeing some bugs with Newlib sprintf and floating point format
>>specifiers. Specifically, the following bits of code work incorrectly,
> 
> 
>>Output On Xilinx PowerPC 405 platform,
>>
>>+00
>>0000
>>+000
>>
>>while on desktop Linux I get,
>>
>>+00.0
>>00000
>>+0000
> 
> 
>   On current cygwin, I get
> 
> dk@rainbow /artimi/software> ./foo.exe
> +00.0
> 00000
> +0000
> dk@rainbow /artimi/software>
> 

The same correct results occur for x86-linux (which uses _ldtoa_r) and 
mn10300-elf which uses _dtoa_r.

I should point out that if your configuration is powerpc-*spe* or 
powerpc-*altivec*, then powerpc supplies its own copy of vfprintf.c 
found in libc/machine/powerpc which has not been kept in lock-step with 
changes in the regular version.  I looked at a diff between the powerpc 
version and the regular vfprintf.c and could only find one diff that 
might be relevant to this situation.  I have attached a patch to this 
note for you to try out if your configuration is relevant (the patch is 
to be applied to libc/machine/powerpc/vfprintf.c).

My only other thought is that perhaps your 1.14.0 attempt somehow got 
the 1.9.0 version of the code.  That is easy enough for you to verify 
via debugging.

-- Jeff J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vfprintf.c.patch
Type: text/x-patch
Size: 715 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20060906/bc54cafa/attachment.bin>


More information about the Newlib mailing list