fix installation
[buildroot.git] / toolchain / gcc / 4.2.2 / 307-locale_facets.patch
blob412f8657dc4e6c4d2192049de7a77810b1f276b7
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 --- gcc-4.2.1/libstdc++-v3/include/bits/locale_facets.tcc 2006-10-17 18:43:47.000000000 +0200
8 +++ gcc-4.2.1-st/libstdc++-v3/include/bits/locale_facets.tcc 2007-08-22 18:54:23.000000000 +0200
9 @@ -1143,7 +1143,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
10 const int __cs_size = __fixed ? __max_exp + __prec + 4
11 : __max_digits * 2 + __prec;
12 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
13 - __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
14 + __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf,
15 __prec, __v);
16 #endif
18 @@ -1777,7 +1777,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
19 // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
20 const int __cs_size = numeric_limits<long double>::max_exponent10 + 3;
21 char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
22 - int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf",
23 + int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf",
24 0, __units);
25 #endif
26 string_type __digits(__len, char_type());