Blame SOURCES/gcc34-rh234515.patch

6fdc0f
2007-01-24   Steve LoBasso <slobasso@yahoo.com>
6fdc0f
	     Paolo Carlini  <pcarlini@suse.de>
6fdc0f
6fdc0f
	* include/bits/deque.tcc (deque<>::erase(iterator, iterator)):
6fdc0f
	Fix condition.
6fdc0f
	* testsuite/23_containers/deque/modifiers/erase/3.cc: New.
6fdc0f
6fdc0f
--- libstdc++-v3/include/bits/deque.tcc	(revision 121146)
6fdc0f
+++ libstdc++-v3/include/bits/deque.tcc	(revision 121147)
6fdc0f
@@ -140,7 +140,7 @@ namespace _GLIBCXX_STD
6fdc0f
 	{
6fdc0f
 	  const difference_type __n = __last - __first;
6fdc0f
 	  const difference_type __elems_before = __first - this->_M_impl._M_start;
6fdc0f
-	  if (static_cast<size_type>(__elems_before) < (size() - __n) / 2)
6fdc0f
+	  if (static_cast<size_type>(__elems_before) <= (size() - __n) / 2)
6fdc0f
 	    {
6fdc0f
 	      std::copy_backward(this->_M_impl._M_start, __first, __last);
6fdc0f
 	      iterator __new_start = this->_M_impl._M_start + __n;
6fdc0f
--- libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/3.cc	(revision 0)
6fdc0f
+++ libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/3.cc	(revision 121147)
6fdc0f
@@ -0,0 +1,52 @@
6fdc0f
+// Copyright (C) 2007 Free Software Foundation, Inc.
6fdc0f
+//
6fdc0f
+// This file is part of the GNU ISO C++ Library.  This library is free
6fdc0f
+// software; you can redistribute it and/or modify it under the
6fdc0f
+// terms of the GNU General Public License as published by the
6fdc0f
+// Free Software Foundation; either version 2, or (at your option)
6fdc0f
+// any later version.
6fdc0f
+
6fdc0f
+// This library is distributed in the hope that it will be useful,
6fdc0f
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
6fdc0f
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6fdc0f
+// GNU General Public License for more details.
6fdc0f
+
6fdc0f
+// You should have received a copy of the GNU General Public License along
6fdc0f
+// with this library; see the file COPYING.  If not, write to the Free
6fdc0f
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
6fdc0f
+// USA.
6fdc0f
+
6fdc0f
+// 23.2.1.3 deque modifiers
6fdc0f
+
6fdc0f
+#include <deque>
6fdc0f
+#include <testsuite_hooks.h>
6fdc0f
+
6fdc0f
+void erase(size_t num_elm, size_t elm_strt, size_t elm_end)
6fdc0f
+{
6fdc0f
+  bool test __attribute__((unused)) = true;
6fdc0f
+  using __gnu_test::copy_tracker;
6fdc0f
+  using __gnu_test::assignment_operator;
6fdc0f
+
6fdc0f
+  std::deque<copy_tracker> x(num_elm);
6fdc0f
+  copy_tracker::reset();
6fdc0f
+  
6fdc0f
+  x.erase(x.begin() + elm_strt, x.begin() + elm_end);
6fdc0f
+  
6fdc0f
+  const size_t min_num_cpy = std::min(elm_strt, num_elm - elm_end);
6fdc0f
+  VERIFY( assignment_operator::count() == min_num_cpy );
6fdc0f
+}
6fdc0f
+
6fdc0f
+// http://gcc.gnu.org/ml/libstdc++/2007-01/msg00098.html
6fdc0f
+void test01()
6fdc0f
+{
6fdc0f
+  for (size_t num_elm = 0; num_elm <= 10; ++num_elm)
6fdc0f
+    for (size_t elm_strt = 0; elm_strt <= num_elm; ++elm_strt)
6fdc0f
+      for (size_t elm_end = elm_strt; elm_end <= num_elm; ++elm_end)
6fdc0f
+	erase(num_elm, elm_strt, elm_end);
6fdc0f
+}
6fdc0f
+
6fdc0f
+int main()
6fdc0f
+{
6fdc0f
+  test01();
6fdc0f
+  return 0;
6fdc0f
+}