From 49caba3beb81216a5a621c7744103e325e6e39de Mon Sep 17 00:00:00 2001
From: Benjamin Kosnik <bkoz@gcc.gnu.org>
Date: Wed, 20 Dec 2000 08:04:41 +0000
Subject: [PATCH] ios.cc (ios_base::_M_grow_words(int ix)): Fix libstdc++/1089.

2000-12-19  Curtis Janssen  <cljanss@ca.sandia.gov>

	* src/ios.cc (ios_base::_M_grow_words(int ix)): Fix libstdc++/1089.
	* testsuite/27_io/ios_base_storage.cc (test01): New file.

From-SVN: r38391
---
 libstdc++-v3/ChangeLog    | 6 ++++++
 libstdc++-v3/configure    | 1 +
 libstdc++-v3/configure.in | 1 +
 libstdc++-v3/src/ios.cc   | 6 ++++--
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 31c4a10bfc8d..7f1d4219f77c 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,6 +1,12 @@
+2000-12-19  Curtis Janssen  <cljanss@ca.sandia.gov>
+
+	* src/ios.cc (ios_base::_M_grow_words(int ix)): Fix libstdc++/1089.
+	* testsuite/27_io/ios_base_storage.cc (test01): New file.
+
 2000-12-19  Benjamin Kosnik  <bkoz@fillmore.constant.com>
 
 	* configure.in: Don't turn on long long by default.
+	(gxx_target_include_dir): Adjuse comment.
 	* configure: Regenerate.
 	* include/c/bits/std_cstdio.h: Remove c++config.h include.
 	* src/locale.cc: Formatting tweaks.
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 4dd963cfc5a9..436e11a57fd0 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -19819,6 +19819,7 @@ fi
 # specified as build_headers in src/Makefile.am in a target-dependent
 # place, or else multiple installs for different compilers will
 # overwrite these files.
+# NB: Keep this and gcc/Makefile.in's -DGPLUSPLUS_TOOL_INCLUDE_DIR in sync.
 gxx_target_include_dir='$(exec_prefix)/$(target_alias)/include/g++-$(libstdcxx_interface)'
 
 
diff --git a/libstdc++-v3/configure.in b/libstdc++-v3/configure.in
index 2823853b8444..d0131479914a 100644
--- a/libstdc++-v3/configure.in
+++ b/libstdc++-v3/configure.in
@@ -279,6 +279,7 @@ fi
 # specified as build_headers in src/Makefile.am in a target-dependent
 # place, or else multiple installs for different compilers will
 # overwrite these files.
+# NB: Keep this and gcc/Makefile.in's -DGPLUSPLUS_TOOL_INCLUDE_DIR in sync.
 gxx_target_include_dir='$(exec_prefix)/$(target_alias)/include/g++-$(libstdcxx_interface)'
 AC_SUBST(gxx_target_include_dir)
 
diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc
index b7b7ff7bb1b9..873bd3b4724b 100644
--- a/libstdc++-v3/src/ios.cc
+++ b/libstdc++-v3/src/ios.cc
@@ -220,8 +220,10 @@ namespace std {
 	    // _M_clear(_M_rdstate() | badbit);  // may throw
 	    return _M_dummy;
 	  }
-	do { words[i] = _M_words[i]; } while (++i < _M_word_limit);
-	if (_M_words != _M_word_array) delete [] _M_words;
+	for (; i < _M_word_limit; i++) 
+	  words[i] = _M_words[i];
+	if (_M_words != _M_word_array) 
+	  delete [] _M_words;
       }
     
     do { words[i] = zero; } while (++i < newlimit);
-- 
GitLab