Forum: ARM programming with GCC/GNU tools Problem with NewLib 1.18.0 in Yagarto 23-12-09

von Jason M. (Company: VPN Solutions Ltd) (the-moog)

Rate this post
0 useful
not useful
I have discovered a problem with Newlib 1.18.0 in the release of Yagarto 

When printf'ing floats it calls Balloc in function dtoa in mprec.c, this 
allocates memory for the structures that are used during the formatting.

For some reason it calls spbrk asking for about 1G of memory. Obviously 
this fails on my system with only 32k.

Reverting to Newlib 1.17.0 resolves this problem.

I barely understand what the code is doing, but I can see that the 
variable k is the cause.   It shifts a 32 bit unsigned int of value 1 by 
k bits,  k is 28 so this becomes a very large number indeed, it then 
multiplies this by the size of a long and calls malloc.  Obviouly malloc 
needs more memory to handle this so calls spbrk.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.