As the PR says, we're calling sputn with a string that is shorter than
the length we specify.

I'm not sure if the length was significant (I don't think so), but
rather than change that I extended the strings to that length.

Tested powerpc64le-linux, committed to trunk.

commit 4f835652c412fbd0300c8b045a5836d116ff56c8
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Tue Sep 29 14:14:15 2015 +0100

    PR libstdc++/67583 Fix invalid sputn calls in tests
    
    	PR libstdc++/67583
    	* testsuite/27_io/basic_stringbuf/seekoff/char/1.cc: Fix sputn call
    	with mismatched arguments.
    	* testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc: Likewise.

diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
index ddc6d97..2cd7696 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
@@ -88,8 +88,10 @@ void test04()
   VERIFY( strmsz_2 != strmsz_1 );
   VERIFY( strmsz_2 == 1 );
   // end part three
+  str_tmp = " ravi shankar meets carlos santana in LoHa   ";
+  str_tmp += str_tmp;
   strmsz_1 = strb_01.str().size();
-  strmsz_2 = strb_01.sputn(" ravi shankar meets carlos santana in LoHa", 90);
+  strmsz_2 = strb_01.sputn(str_tmp.c_str(), str_tmp.size());
   strb_01.pubseekoff(0, std::ios_base::end);
   strb_01.sputc('<');
   str_tmp = strb_01.str();
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc
index 8678536..0dd0974 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc
@@ -88,8 +88,10 @@ void test04()
   VERIFY( strmsz_2 != strmsz_1 );
   VERIFY( strmsz_2 == 1 );
   // end part three
+  str_tmp = L" ravi shankar meets carlos santana in LoHa   ";
+  str_tmp += str_tmp;
   strmsz_1 = strb_01.str().size();
-  strmsz_2 = strb_01.sputn(L" ravi shankar meets carlos santana in LoHa", 90);
+  strmsz_2 = strb_01.sputn(str_tmp.c_str(), str_tmp.size());
   strb_01.pubseekoff(0, std::ios_base::end);
   strb_01.sputc(L'<');
   str_tmp = strb_01.str();

Reply via email to