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]
Other format: [Raw text]

[Patch] Fix libstdc++/16959


Hi,

if nobody objects tomorrow (italian time) I will commit to mainline
and 3_4 the below, suggested by Pétur.

Tested x86-linux.

Paolo.

//////////////
2004-08-11  Paolo Carlini  <pcarlini@suse.de>
	    Petur Runolfsson  <peturr02@ru.is>

	PR libstdc++/16959
	* src/ios_init.cc (ios_base::sync_with_stdio): Make sure the
	standard streams are constructed.
	* testsuite/27_io/ios_base/sync_with_stdio/16959.cc: New.
diff -urN libstdc++-v3-orig/src/ios_init.cc libstdc++-v3/src/ios_init.cc
--- libstdc++-v3-orig/src/ios_init.cc	2004-02-27 01:49:49.000000000 +0100
+++ libstdc++-v3/src/ios_init.cc	2004-08-11 01:19:14.000000000 +0200
@@ -155,6 +155,9 @@
     // currently synchronized.
     if (!__sync && __ret)
       {
+	// Make sure the standard streams are constructed.
+	ios_base::Init __init;
+
 	ios_base::Init::_S_synced_with_stdio = __sync;
 
 	// Explicitly call dtors to free any memory that is
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/sync_with_stdio/16959.cc libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/sync_with_stdio/16959.cc	1970-01-01 01:00:00.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc	2004-08-11 01:30:37.000000000 +0200
@@ -0,0 +1,33 @@
+// Copyright (C) 2004 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.4.2.4 ios_base static members
+
+#include <ios>
+
+// libstdc++/16959
+void test01()
+{
+  std::ios_base::sync_with_stdio(false);
+}
+
+int main()
+{
+  test01();
+  return 0;
+}

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