From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id B341F394C000 for ; Thu, 14 Jan 2021 19:20:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B341F394C000 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-T-XMseGpPK68TQqsIf8rWA-1; Thu, 14 Jan 2021 14:20:40 -0500 X-MC-Unique: T-XMseGpPK68TQqsIf8rWA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C6CFBBEE6; Thu, 14 Jan 2021 19:20:39 +0000 (UTC) Received: from localhost (unknown [10.33.37.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD2D219C48; Thu, 14 Jan 2021 19:20:38 +0000 (UTC) Date: Thu, 14 Jan 2021 19:20:38 +0000 From: Jonathan Wakely To: =?iso-8859-1?Q?Fran=E7ois?= Dumont Cc: "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: [PATCH] libstdc++/98466 Fix _GLIBCXX_DEBUG N3644 integration Message-ID: <20210114192038.GK7692@redhat.com> References: <9c1f5008-1ded-fed1-bc57-309ec74b9c77@gmail.com> <20210114171003.GI7692@redhat.com> <80e7bf60-ca64-1ddb-e9b0-90005c37bcd2@gmail.com> MIME-Version: 1.0 In-Reply-To: <80e7bf60-ca64-1ddb-e9b0-90005c37bcd2@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2021 19:20:44 -0000 On 14/01/21 19:33 +0100, François Dumont wrote: >On 14/01/21 6:10 pm, Jonathan Wakely wrote: >>On 01/01/21 18:51 +0100, François Dumont via Libstdc++ wrote: >>>I think the PR is not limited to unordered containers iterator, it >>>impacts all _GLIBCXX_DEBUG iterators. >>> >>>However unordered containers local_iterator was more complicated >>>to handle. Because of c++/65816 I prefer to review >>>_Node_iterator_default constructor to set _M_cur to nullptr even >>>if in principle it is not necessary except for the >>>_Local_iterator_base constructor when hash code is not cached. >>> >>>    libstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators >>> >>>    libstdc++-v3/ChangeLog >>> >>>            PR libstdc++/98466 >>>            * include/bits/hashtable_policy.h >>>(_Node_iterator_base()): Set _M_cur to nullptr. >>>            (_Node_iterator()): Make default. >>>            (_Node_const_iterator()): Make default. >>>            * include/debug/macros.h >>>(__glibcxx_check_erae_range_after): Add _M_singular >>>            iterator checks. >>>            * include/debug/safe_iterator.h >>>            (_GLIBCXX_DEBUG_VERIFY_OPERANDS): Accept if >>>both iterator are value initialized. >>>            * include/debug/safe_local_iterator.h >>>(_GLIBCXX_DEBUG_VERIFY_OPERANDS): >>>            Likewise. >>>            * include/debug/safe_iterator.tcc >>>(_Safe_iterator<>::_M_valid_range): Add >>>            _M_singular checks on input iterators. >>>            * src/c++11/debug.cc >>>(_Safe_iterator_base::_M_can_compare): Remove _M_singular >>>            checks. >>>            * >>>testsuite/23_containers/deque/debug/98466.cc: New test. >>>            * >>>testsuite/23_containers/unordered_map/debug/98466.cc: New test. >>> >>>Tested under Linux x86_64 normal and debug mode. >>> >>>Ok to commit ? >> >>Yes, thanks. >> >>One question about the deque test ... >> >> >>>diff --git >>>a/libstdc++-v3/testsuite/23_containers/deque/debug/98466.cc >>>b/libstdc++-v3/testsuite/23_containers/deque/debug/98466.cc >>>new file mode 100644 >>>index 00000000000..720977e5622 >>>--- /dev/null >>>+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/98466.cc >>>@@ -0,0 +1,38 @@ >>>+// Copyright (C) 2021 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 >>>+// terms of the GNU General Public License as published by the >>>+// Free Software Foundation; either version 3, or (at your option) >>>+// any later version. >>>+ >>>+// This library is distributed in the hope that it will be useful, >>>+// but WITHOUT ANY WARRANTY; without even the implied warranty of >>>+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the >>>+// GNU General Public License for more details. >>>+ >>>+// You should have received a copy of the GNU General Public >>>License along >>>+// with this library; see the file COPYING3.  If not see >>>+// . >>>+ >>>+// { dg-do run { target c++11 } } >> >>Does this need to be limited to c++11 and later? Could it just use >>{ dg-do run } instead? > >Good point, a bad copy/paste from the unordered test I guess. > >But I try to remove it and it complained about invalid '{}' syntax in >C++98 for the iterator value initialization. I try to replace with >'()' but then ambiguity with a function declaration, I gave up ! > >As N3644 is talking about value initialization it doesn't sound that >bad to limit it to C++11, isn't it a C++11 concept ? No, it was added in C++03. You can do this to avoid it being treated as a function declaration: __gnu_debug::deque::iterator it = __gnu_debug::deque::iterator(); OK to commit with that change if it passes in C++98 mode.