1 This patch fixes a bug into ostream::operator<<(double) due to the wrong size
2 passed into the __convert_from_v method. The wrong size is then passed to
3 std::snprintf function, that, on uClibc, doens't handle sized 0 buffer.
5 Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
7 Index: gcc-4.2.3/libstdc++-v3/include/bits/locale_facets.tcc
8 ===================================================================
9 --- gcc-4.2.3.orig/libstdc++-v3/include/bits/locale_facets.tcc 2008-01-05 12:04:43.000000000 +0100
10 +++ gcc-4.2.3/libstdc++-v3/include/bits/locale_facets.tcc 2008-05-21 13:45:51.877288338 +0200
12 const int __cs_size = __fixed ? __max_exp + __prec + 4
13 : __max_digits * 2 + __prec;
14 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
15 - __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
16 + __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf,
21 // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
22 const int __cs_size = numeric_limits<long double>::max_exponent10 + 3;
23 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
24 - int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf",
25 + int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf",
28 string_type __digits(__len, char_type());