title: newlib and C++ causing hard faults
body: <p>I am relatively new to newlib, so my questions may sound stupid.... </p>
  
  <p>I have an ARM CortexM4 project done in C and added a C++ library to project. I changed the linker executable from arm-none-eabi-gcc  to arm-none-eabi-g++.  In doing so I noticed that I started getting hard faults on the processor. </p>
  
  <p>I found that __libc_init_array(); was allocating around 2500 bytes from heap, which I had limited to 4k in linker script. Then after this quickly my heap ran out of space. My sbrk() does return -1 when it exceeds heap, however during a call sprintf() using floating point I noticed that dtoa() appears to try and allocate 4096 bytes from the heap, which fails and then shortly after I get the hard fault in d2b().  Note the hard fault appears to be from trying to read/write to address -1, which might be a bug in dtoa() not checking malloc return value. </p>
  
  <p>If I change my linker back to gcc it all works, and I don't get large heap allocations.</p>
  
  <p>I was wondering if this was normal or a bug, if normal could someone explain what is happening with large heap allocations? </p>
  
  <p>Note I am using GNU Tools for ARM version 5.2 2015sq4, but I am unsure how to check newlib versions. </p>