From patchwork Thu Sep 27 00:02:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v3] libstdc++/53515 Date: Wed, 26 Sep 2012 14:02:45 -0000 From: Paolo Carlini X-Patchwork-Id: 187249 Message-Id: <506397A5.5060406@oracle.com> To: "gcc-patches@gcc.gnu.org" Cc: libstdc++ Hi, tested x86_64-linux, committed to mainline. Paolo. /////////////////////// 2012-09-26 Akira Takahashi PR libstdc++/53515 * include/bits/stl_iterator_base_funcs.h (__advance(_InputIterator&, _Distance, input_iterator_tag)): Add _GLIBCXX_DEBUG_ASSERT(__n >= 0). Index: include/bits/stl_iterator_base_funcs.h =================================================================== --- include/bits/stl_iterator_base_funcs.h (revision 191781) +++ include/bits/stl_iterator_base_funcs.h (working copy) @@ -1,7 +1,6 @@ // Functions used by iterators -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -// Free Software Foundation, Inc. +// Copyright (C) 2001-2012 Free Software Foundation, Inc. // // 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 @@ -63,6 +62,7 @@ #pragma GCC system_header #include +#include namespace std _GLIBCXX_VISIBILITY(default) { @@ -124,6 +124,7 @@ { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + _GLIBCXX_DEBUG_ASSERT(__n >= 0); while (__n--) ++__i; }