Problems with printing double-values with printf and sprintf

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 4 14:50:23 UTC 2009


The calculation in dtoa.c line 295 is wrong because the values for Exp_shift1
and Exp_mask are invalid for the little endian ARM (this is only a good guess
at the moment).  Exp_shift1 has the value 20 and should have the value 23.
These values are defined in

./newlib/libc/stdio/vfieeefp.h
./newlib/libc/stdlib/mprec.h

It looks like the __IEEE_LITTLE_ENDIAN is undefined.

Sebastian Huber wrote:
> The problem is in the function dtoa_r() in file dtoa.c line 430. Somehow the
> value for _REENT_MP_RESULT(ptr) is to big and arbitrary memory will be overwritten.
> 
> Ralf Corsepius wrote:
>> On 08/17/2009 12:34 PM, Christian Mauderer wrote:
>>
>>> I'm using the newlib 1.17.0 with RTEMS 4.10 patches out of the
>>> rtems-4.10-newlib-common-1.17.0-44.suse10.3 rpm.
>>>
>>> I'm using the following CFLAGS:
>>> -mcpu=arm7tdmi-s -mstructure-size-boundary=8 -mapcs-frame -mthumb -Os -g
>> Well, that's a lot of obscure flags, of which each may cause your problem.
>>
>> => We need to further isolate the problem.
>>
>> Can you try to build and excute something similar to this:
>> printf( "%f\n", 1.2345 );
>>
>> while permuting the CFLAGS you are using, esp.
>> -mcpu=arm7tdmi-s, -mapcs-frame and -mthumb?
>>
>> Ralf
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-users
> 
> 


-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list