From patchwork Tue Dec 6 14:34:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 86849 Delivered-To: patch@linaro.org Received: by 10.182.112.6 with SMTP id im6csp2315616obb; Tue, 6 Dec 2016 06:34:38 -0800 (PST) X-Received: by 10.99.3.202 with SMTP id 193mr112531211pgd.157.1481034878134; Tue, 06 Dec 2016 06:34:38 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id c62si19779299pfg.22.2016.12.06.06.34.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 06:34:38 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443595-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443595-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443595-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=tjlzOjq9nyGAr+9qK NOVtHoLBXpIzUrZYcl7E0VtWnManTQ+vsL0lV15J6d5vOrjlyMgouTGja+9DZpXE McGmjuU/3q+du4VKF9t9eCBv5Vc0YZ4e9sUNnW+aZ2jmtaIzStonaenhtCBfDTQY gdJeYPLhUJTyvrBnbyiWep8vlY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=5tuQuKahFj4cN6BsCvRou3S +q8I=; b=uTSEv4HAfzv8ksOqX76chZuNXvrxiSQbcI3Y69BRUePEp53+wRF1RYa 2Lsy1gxmUc5K3gZB5X7jDBEBz8E8r81HqPiL+g5qAYAZoFQ8zZ/35YHMwny8iZpz YoYpfX6Wuz0bKysXwQGVSrQw0yjkqavz9g46CrDwOU0mSCEnidSU= Received: (qmail 30015 invoked by alias); 6 Dec 2016 14:34:19 -0000 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 Received: (qmail 29994 invoked by uid 89); 6 Dec 2016 14:34:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1819, Partial X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Dec 2016 14:34:16 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5D3868B2; Tue, 6 Dec 2016 14:34:14 +0000 (UTC) Received: from localhost (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB6EYD6o029868; Tue, 6 Dec 2016 09:34:14 -0500 Date: Tue, 6 Dec 2016 14:34:13 +0000 From: Jonathan Wakely To: Tim Shen Cc: libstdc++ , gcc-patches Subject: Re: [PATCH] Partial solution to LWG 523 Message-ID: <20161206143413.GL6326@redhat.com> References: <20161130130324.GQ3301@redhat.com> <20161130144526.GR3301@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161130144526.GR3301@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) On 30/11/16 14:45 +0000, Jonathan Wakely wrote: >On 30/11/16 13:03 +0000, Jonathan Wakely wrote: >>On 26/11/16 16:27 -0800, Tim Shen wrote: >>>diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h >>>index 953aa87..2fb70b7 100644 >>>--- a/libstdc++-v3/include/bits/shared_ptr_base.h >>>+++ b/libstdc++-v3/include/bits/shared_ptr_base.h >>>@@ -1000,7 +1000,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >>> element_type& >>> operator*() const noexcept >>> { >>>- __glibcxx_assert(_M_ptr != nullptr); >>>+ __glibcxx_assert(_M_get() != nullptr); >>> return *_M_get(); >>> } >> >>Oops, thanks, but let's fix this separately (I'll do it now) so the >>rest of the patch only touches regex stuff. > >I've fixed that with this patch, committed to trunk. > There's a similar problem in the __shared_ptr_access specialization for shared_ptr, fixed by this patch. commit b69bee71a9eaa91f3a6fae875d702c9d39b02354 Author: Jonathan Wakely Date: Tue Dec 6 14:13:54 2016 +0000 Fix debug mode assertion for std::shared_ptr * include/bits/shared_ptr_base.h (__shared_ptr_access::operator->()): Fix assertion. diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index 2fb70b7..7e02043 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -983,8 +983,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION element_type* operator->() const noexcept { - _GLIBCXX_DEBUG_PEDASSERT(_M_get() != nullptr); - return static_cast*>(this)->get(); + auto __ptr = static_cast*>(this)->get(); + _GLIBCXX_DEBUG_PEDASSERT(__ptr != nullptr); + return __ptr; } };