From patchwork Wed Nov 7 09:18:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 197637 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 28BB22C00E1 for ; Wed, 7 Nov 2012 20:19:21 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352884762; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=e/lMO80nTppg7ChKqE3SdZhzBWk=; b=m+xigDt6Ui5+Q8v/o2kSTHOrx2oJJSdCcOTXwgOqR/x3F+3+uztikY2+AcELMW +RnKo8WGd9o8BlNsyFgLIZ+ZSREhO1ibUEbS8in1zQwbEMd5pzv9oWeYjybtWwRa fMw9fX8ZLKD9xviMFJBlUlH3zH8NZhNkFnZPaQgGiXsCc= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=aNVHckY4Ls1s9ou6/xTCdPglbMMtXi+3SStoNEf7rihUPc6NDEBgyCxhYou2lk 6BqkJmklvihBLyoJ7fCy1oqZGSg0NGNYlFy0GM/PEo7th9/oNpE/IhtnQoCg4CXU CnT7Eb8/DxzS4YXKc+9WVLWHOfmvW6UYGhaGZuekUeO0Y=; Received: (qmail 26774 invoked by alias); 7 Nov 2012 09:19:07 -0000 Received: (qmail 26758 invoked by uid 22791); 7 Nov 2012 09:19:06 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Nov 2012 09:18:59 +0000 Received: by mail-ie0-f175.google.com with SMTP id c13so2101744ieb.20 for ; Wed, 07 Nov 2012 01:18:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.151.238 with SMTP id ut14mr1369318igb.58.1352279939243; Wed, 07 Nov 2012 01:18:59 -0800 (PST) Received: by 10.42.158.202 with HTTP; Wed, 7 Nov 2012 01:18:59 -0800 (PST) In-Reply-To: References: <50995544.6020707@oracle.com> Date: Wed, 7 Nov 2012 09:18:59 +0000 Message-ID: Subject: Re: [v3] Fix profile mode failures From: Jonathan Wakely To: Paolo Carlini Cc: "libstdc++" , gcc-patches Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 6 November 2012 19:41, Jonathan Wakely wrote: > On 6 November 2012 18:21, Paolo Carlini wrote: >> >> testsuite/20_util/scoped_allocator/1.cc:79: void test02(): Assertion >> `evv[0].get_allocator().get_personality() == 2' failed. >> >> I didn't really investigate it... > > Oops, looks like I missed something, will fix it asap ... Fixed with this patch, which also adds an allocator parameter to the vector(size_type) constructor, which is missing from the standard but I hope to get fixed via http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2210 Tested x86_64-linux, in normal, debug and profile mode, committed to trunk. I still see some other profile-mode failures, not sure if they're old or I caused them recently, will investigate further. commit f1d4bcfe4fb152e0db4bdd7093ad8885e6d88a80 Author: Jonathan Wakely Date: Wed Nov 7 01:03:35 2012 +0000 * include/bits/stl_vector.h (vector(size_type)): Add missing allocator parameter. * include/bits/stl_bvector.h: Likewise. * include/debug/vector (vector(size_type)): Likewise. * include/profile/vector (vector(size_type)): Likewise. Pass allocator to base constructor. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 3adbfa1..b8d3efb 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -555,6 +555,21 @@ template vector(const allocator_type& __a) : _Base(__a) { } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit + vector(size_type __n, const allocator_type& __a = allocator_type()) + : vector(__n, false, __a) + { } + + vector(size_type __n, const bool& __value, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_initialize(__n); + std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, + __value ? ~0 : 0); + } +#else explicit vector(size_type __n, const bool& __value = bool(), const allocator_type& __a = allocator_type()) @@ -564,6 +579,7 @@ template std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, __value ? ~0 : 0); } +#endif vector(const vector& __x) : _Base(__x._M_get_Bit_allocator()) diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 6e229aa..1f14f7e 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -261,13 +261,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief Creates a %vector with default constructed elements. * @param __n The number of elements to initially create. + * @param __a An allocator. * * This constructor fills the %vector with @a __n default * constructed elements. */ explicit - vector(size_type __n) - : _Base(__n) + vector(size_type __n, const allocator_type& __a = allocator_type()) + : _Base(__n, __a) { _M_default_initialize(__n); } /** diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index 9c33fdf..fe65bab 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -83,8 +83,8 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ explicit - vector(size_type __n) - : _Base(__n), _M_guaranteed_capacity(__n) { } + vector(size_type __n, const _Allocator& __a = _Allocator()) + : _Base(__n, __a), _M_guaranteed_capacity(__n) { } vector(size_type __n, const _Tp& __value, const _Allocator& __a = _Allocator()) diff --git a/libstdc++-v3/include/profile/vector b/libstdc++-v3/include/profile/vector index fcd6962..ec931a3 100644 --- a/libstdc++-v3/include/profile/vector +++ b/libstdc++-v3/include/profile/vector @@ -84,8 +84,8 @@ namespace __profile #ifdef __GXX_EXPERIMENTAL_CXX0X__ explicit - vector(size_type __n) - : _Base(__n) + vector(size_type __n, const _Allocator& __a = _Allocator()) + : _Base(__n, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); @@ -147,7 +147,7 @@ namespace __profile } vector(const _Base& __x, const _Allocator& __a) - : _Base(__x) + : _Base(__x, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index 320f4dd..8c00989 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1236 } +// { dg-error "no matching" "" { target *-*-* } 1237 } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index 78a6ead..e5a4644 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1166 } +// { dg-error "no matching" "" { target *-*-* } 1167 } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index af12c6d..9e2924c 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1166 } +// { dg-error "no matching" "" { target *-*-* } 1167 } #include #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index da88180..e4bec26 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1277 } +// { dg-error "no matching" "" { target *-*-* } 1278 } #include