Re: Patch to fix libstdc++ std::showpos

2011-03-02 Thread Matthew Dempsky
On Tue, Mar 1, 2011 at 7:39 PM, Brad b...@comstyle.com wrote:
 There is currently a bug with std::showpos with the older
 version of libstdc++-v3 that is bundled with gcc 4.2.1
 in-tree. It was exposed by the Gnash testsuite when
 dates were not being formatted correctly showing
 GMT0 instead of GMT+ as expected.

An even simpler test case is that the following program should print
+0, not just 0:

#include iostream
using namespace std;
int main() {
  cout  showpos  0  endl;
}

ok matthew@



Patch to fix libstdc++ std::showpos

2011-03-01 Thread Brad
There is currently a bug with std::showpos with the older
version of libstdc++-v3 that is bundled with gcc 4.2.1
in-tree. It was exposed by the Gnash testsuite when
dates were not being formatted correctly showing
GMT0 instead of GMT+ as expected.



2007-11-26  Paolo Carlini  pcarl...@suse.de

* include/bits/locale_facets.tcc (num_put::_M_insert_int): When
ios_base::showpos and the type is signed and the value is zero,
prepend +.


Index: gnu/gcc/libstdc++-v3/include/bits/locale_facets.tcc
===
RCS file: /home/cvs/src/gnu/gcc/libstdc++-v3/include/bits/locale_facets.tcc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 locale_facets.tcc
--- gnu/gcc/libstdc++-v3/include/bits/locale_facets.tcc 15 Oct 2009 17:11:32 
-  1.1.1.1
+++ gnu/gcc/libstdc++-v3/include/bits/locale_facets.tcc 6 Feb 2011 21:40:46 
-
@@ -1015,13 +1015,13 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
if (__builtin_expect(__dec, true))
  {
// Decimal.
-   if (__v  0)
+   if (__v = 0)
  {
if (__flags  ios_base::showpos
 numeric_limits_ValueT::is_signed)
  *--__cs = __lit[__num_base::_S_oplus], ++__len;
  }
-   else if (__v)
+   else
  *--__cs = __lit[__num_base::_S_ominus], ++__len;
  }
else if (__flags  ios_base::showbase  __v)

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.