From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128202 invoked by alias); 3 Jul 2015 10:29:27 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 128171 invoked by uid 48); 3 Jul 2015 10:29:22 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/66742] abort on sorting list with custom compiler that is not stateless Date: Fri, 03 Jul 2015 10:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg00243.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66742 --- Comment #6 from Jonathan Wakely --- So we need something ugly like this: --- a/libstdc++-v3/include/bits/list.tcc +++ b/libstdc++-v3/include/bits/list.tcc @@ -398,6 +398,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } } +#define _GLIBCXX_REPEAT_8(_X) _X, _X, _X, _X, _X, _X, _X, _X + template void list<_Tp, _Alloc>:: @@ -407,8 +409,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node) { - list __carry; - list __tmp[64]; + list __carry(get_allocator()); + list __tmp[64] = { + _GLIBCXX_REPEAT_8(_GLIBCXX_REPEAT_8(list(get_allocator()))) + }; list * __fill = &__tmp[0]; list * __counter; @@ -484,8 +488,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node) { - list __carry; - list __tmp[64]; + list __carry(get_allocator()); + list __tmp[64] = { + _GLIBCXX_REPEAT_8(_GLIBCXX_REPEAT_8(list(get_allocator()))) + }; list * __fill = &__tmp[0]; list * __counter; @@ -511,6 +517,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER swap(*(__fill - 1)); } } +#undef _GLIBCXX_REPEAT_8 _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std