Commit f8af8c09 by Paolo Carlini Committed by Paolo Carlini

re PR libstdc++/36338 (heap_sort effectively hangs with -D_GLIBCXX_DEBUG)

2008-05-31  Paolo Carlini  <paolo.carlini@oracle.com>
	    Chris Jefferson  <chris@bubblescope.net>

	PR libstdc++/36338
	* include/bits/stl_heap.h (sort_heap): Use __pop_heap directly.
	(pop_heap): Slightly tweak.

Co-Authored-By: Chris Jefferson <chris@bubblescope.net>

From-SVN: r136242
parent 7306494a
2008-05-31 Paolo Carlini <paolo.carlini@oracle.com>
Chris Jefferson <chris@bubblescope.net>
PR libstdc++/36338
* include/bits/stl_heap.h (sort_heap): Use __pop_heap directly.
(pop_heap): Slightly tweak.
2008-05-29 Paolo Carlini <paolo.carlini@oracle.com> 2008-05-29 Paolo Carlini <paolo.carlini@oracle.com>
* include/debug/bitset (bitset(const char*)): Implement DR 778 * include/debug/bitset (bitset(const char*)): Implement DR 778
......
// Heap implementation -*- C++ -*- // Heap implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -285,7 +285,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -285,7 +285,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_heap(__first, __last); __glibcxx_requires_heap(__first, __last);
std::__pop_heap(__first, __last - 1, __last - 1); --__last;
std::__pop_heap(__first, __last, __last);
} }
template<typename _RandomAccessIterator, typename _Distance, template<typename _RandomAccessIterator, typename _Distance,
...@@ -355,7 +356,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -355,7 +356,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_heap_pred(__first, __last, __comp); __glibcxx_requires_heap_pred(__first, __last, __comp);
std::__pop_heap(__first, __last - 1, __last - 1, __comp); --__last;
std::__pop_heap(__first, __last, __last, __comp);
} }
/** /**
...@@ -458,7 +460,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -458,7 +460,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__glibcxx_requires_heap(__first, __last); __glibcxx_requires_heap(__first, __last);
while (__last - __first > 1) while (__last - __first > 1)
std::pop_heap(__first, _RandomAccessIterator(__last--)); {
--__last;
std::__pop_heap(__first, __last, __last);
}
} }
/** /**
...@@ -483,7 +488,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -483,7 +488,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__glibcxx_requires_heap_pred(__first, __last, __comp); __glibcxx_requires_heap_pred(__first, __last, __comp);
while (__last - __first > 1) while (__last - __first > 1)
std::pop_heap(__first, _RandomAccessIterator(__last--), __comp); {
--__last;
std::__pop_heap(__first, __last, __last, __comp);
}
} }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment