aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-08-11 09:31:13 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2004-08-11 09:31:13 +0000
commit48dd95f2a4c68e47d7afe372ed02f76446a0f9d9 (patch)
tree4562fb2b983eed6cff8660347aed14fbf729767b
parenta77655b15fc9e25c0c3ad647eb0f511463a559c5 (diff)
downloadgcc-48dd95f2a4c68e47d7afe372ed02f76446a0f9d9.zip
gcc-48dd95f2a4c68e47d7afe372ed02f76446a0f9d9.tar.gz
gcc-48dd95f2a4c68e47d7afe372ed02f76446a0f9d9.tar.bz2
re PR libstdc++/16959 (Segmentation fault in ios_base::sync_with_stdio)
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. Co-Authored-By: Petur Runolfsson <peturr02@ru.is> From-SVN: r85797
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/src/ios_init.cc3
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc33
3 files changed, 44 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 816c4e7..005df42 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
2004-08-09 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h: Trivial formatting fixes.
diff --git a/libstdc++-v3/src/ios_init.cc b/libstdc++-v3/src/ios_init.cc
index ae7b8e1..346ed4e 100644
--- a/libstdc++-v3/src/ios_init.cc
+++ b/libstdc++-v3/src/ios_init.cc
@@ -155,6 +155,9 @@ namespace std
// 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 --git a/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc
new file mode 100644
index 0000000..8d3826b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/sync_with_stdio/16959.cc
@@ -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;
+}