This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Slightly improved fix for libstdc++/4402


Benjamin Kosnik wrote:

> Great, can you post a ChangeLog entry, and also add a testcase entry for
> this?

Thanks!

Here is my tentative changelog:

2001-11-13  Paolo Carlini  <pcarlini@unitus.it>

 * testsuite/27_io/ostream_inserter_arith.cc: Testcase from libstdc++/4402.
 * include/bits/locale_facets.tcc (num_put::do_put(doubles, long doubles))
Fix for listdc++/4402, robustify.


And here a minimal patch for the testsuite:

*** ostream_inserter_arith.cc.orig Sun Nov 11 13:48:59 2001
--- ostream_inserter_arith.cc Sun Nov 11 15:13:47 2001
*************** test02()
*** 272,277 ****
--- 272,293 ----
  #endif
    VERIFY(os && os.str() == largebuf);

+   // make sure we can output a long float in std::fixed format
+   // without seg-faulting (libstdc++/4402)
+   double val2 = 3.5e230;
+
+   ostringstream os2;
+   os2.precision(3);
+   os2.setf(ios::fixed);
+   os2 << val2;
+
+   sprintf(largebuf, "%.*f", 3, val2);
+ #ifdef TEST_NUMPUT_VERBOSE
+   cout << "expect: " << largebuf << endl;
+   cout << "result: " << os2.str() << endl;
+ #endif
+   VERIFY(os2 && os2.str() == largebuf);
+
    return 0;
  }




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]