From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iXl2KJ2qAGs0HiUAWB0awg (envelope-from ) for ; Fri, 20 Nov 2026 15:16:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1795205789; bh=Lu9AxxrDoyzzDVP4H3NV64YgaOKe8m2D0ShnLSeh8RA=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tWExJS6XWW0E+O7KDDgM6cBilgJPLLxtkhg1W2wNLSYf3MPTgaEr9XGVpoNMhtnoo 96fXbbzzEAGn28qm0I10i0uAwyAF5vewS6AubSZNin1SgTQ5jo2EecuFozLk46/iFV CZlsrRP7XdVyPErlk/YTIFhQy6RwRPvqcn9DqjP4= Received: by simark.ca (Postfix, from userid 112) id A03DE1E0CA; Fri, 20 Nov 2026 15:16:29 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=uIm5+nKA; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5DE821E023 for ; Fri, 20 Nov 2026 15:16:28 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 979BB40A1F9E for ; Fri, 20 Nov 2026 20:16:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 979BB40A1F9E Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=uIm5+nKA Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id CC83740A24AA for ; Fri, 20 Nov 2026 20:16:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC83740A24AA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CC83740A24AA Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795205761; cv=none; b=hIOR7rJK1RXN7coabsjDybuKcPVLpRoSJiMqWTfDpKimnk2M/iGOHWbGlBcvZKqIdHKTCzZg4bml1j4JloRAihs4V4nYfRW2T6JeAagD7H/WLXYf0Bvl87a7U+N3wUbz5L3pZQRKCkCad2oSdZfYzGP0D/YyO797svcBen7Ur0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795205761; c=relaxed/simple; bh=Lu9AxxrDoyzzDVP4H3NV64YgaOKe8m2D0ShnLSeh8RA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=k3ytsanVpHTpj0Amg6kfMkTTHpu6nhZ0EsZoSDbV90v/gADe26O2DhWLR9erJ4M/0nuDEVfTXUjyCnRY4UjWyISySA/JTT80WbeYndKnv4W6G9Q1hh4cExSZsvwB+TYYzt4jC/hsD1Bo1BIpxhHpE9JObs7E53uz5zre3WT+9TI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=uIm5+nKA DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC83740A24AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1795205759; bh=Lu9AxxrDoyzzDVP4H3NV64YgaOKe8m2D0ShnLSeh8RA=; h=Date:Subject:To:References:From:In-Reply-To:From; b=uIm5+nKAwaHVJUtC1ZrVEHFeqpZsggSXeAwJ1J1KLtaH7PVxpWFBITbUf7N5lNpiz sOtQHGFaVCqgx0j+LGflKOJ22dxan+bcvAjJF1N57cVSQOA6GOLhCLWHvMFLX8LJEX 4fjbvH5fBwzDFXrz4zn3WN9nOq9dbbEaLxpxx4BA= Received: by simark.ca (Postfix) id 80A7C1E023; Fri, 20 Nov 2026 15:15:58 -0500 (EST) Message-ID: Date: Fri, 20 Nov 2026 15:15:57 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 15/16] Allow the use of C++20 std::span in gdbsupport/span.h To: Jan Vrany , Tom Tromey , gdb-patches@sourceware.org References: <20261118-span-part-1-v4-0-5ecf901e570b@adacore.com> <20261118-span-part-1-v4-15-5ecf901e570b@adacore.com> <7e87cf228454f373b9f1e70816b01db5225bfed8.camel@vrany.io> Content-Language: fr From: Simon Marchi In-Reply-To: <7e87cf228454f373b9f1e70816b01db5225bfed8.camel@vrany.io> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 11/20/26 10:52 AM, Jan Vrany wrote: > On Wed, 2026-11-18 at 15:56 -0700, Tom Tromey wrote: >> This patch changes gdbsupport/span.h to check __cplusplus and then to >> use std::span in this setup. >> >> Eventually, when gdb moves to C++20 (PR gdb/32660), this header can be >> greatly simplified and we can rewrite "gdb::span" to "std::span". >> Note that the header won't be really removable, because there are some >> utility functions here that will need to remain. >> >> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31422 > > I just noticed that this breaks when compiling with -D_GLIBCXX_DEBUG=1 : > > CXX unittests/span-selftests.o > In file included from /usr/include/c++/16/debug/debug.h:90, > from /usr/include/c++/16/bits/stl_algobase.h:68, > from /usr/include/c++/16/bits/hashtable_policy.h:37, > from /usr/include/c++/16/bits/hashtable.h:37, > from /usr/include/c++/16/bits/unordered_map.h:33, > from /usr/include/c++/16/unordered_map:43, > from /usr/include/c++/16/functional:80, > from ./../gdbsupport/ptid.h:35, > from ./../gdbsupport/common-defs.h:212, > from ././defs.h:26, > from : > /usr/include/c++/16/span: In instantiation of ‘constexpr std::span<_Type, _Extent>::span(_It, _End) [with _It = const unsigned char*; _End = unsigned char*; _Type = const unsigned char; long unsigned int _Extent = 18446744073709551615]’: > unittests/span-selftests.c:332:41: required from here > 332 | gdb::span view1 (cp, p); > | ^ > /usr/include/c++/16/span:196:11: error: no matching function for call to ‘__valid_range(const unsigned char*&, unsigned char*&)’ > 196 | { __glibcxx_requires_valid_range(__first, __last); } > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > • there are 8 candidates > In file included from /usr/include/c++/16/debug/stl_iterator.h:32, > from /usr/include/c++/16/bits/stl_iterator.h:3133, > from /usr/include/c++/16/bits/ranges_base.h:39, > from /usr/include/c++/16/bits/ranges_util.h:34, > from /usr/include/c++/16/tuple:46, > from /usr/include/c++/16/functional:71: > • candidate 1: ‘template constexpr bool __gnu_debug::__valid_range(_InputIterator, _InputIterator)’ > /usr/include/c++/16/debug/helper_functions.h:200:5: > 200 | __valid_range(_InputIterator __first, _InputIterator __last) > | ^~~~~~~~~~~~~ > • template argument deduction/substitution failed: > • deduced conflicting types for parameter ‘_InputIterator’ (‘const unsigned char*’ and ‘unsigned char*’) > /usr/include/c++/16/span:196:11: > 196 | { __glibcxx_requires_valid_range(__first, __last); } > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > • candidate 2: ‘template constexpr bool __gnu_debug::__valid_range(_InputIterator, _InputIterator, typename _Distance_traits<_Iterator>::__type&)’ > /usr/include/c++/16/debug/helper_functions.h:219:5: > 219 | __valid_range(_InputIterator __first, _InputIterator __last, > | ^~~~~~~~~~~~~ > • candidate expects 3 arguments, 2 provided > In file included from /usr/include/c++/16/debug/unordered_map:53, > from /usr/include/c++/16/unordered_map:48: > • candidate 3: ‘template constexpr bool __gnu_debug::__valid_range(const _Safe_iterator<_Iterator, _Sequence, _Category>&, const _Safe_iterator<_Iterator, _Sequence, _Category>&, typename _Distance_traits<_Iterator>::__type&)’ > /usr/include/c++/16/debug/safe_iterator.h:1119:5: > 1119 | __valid_range(const _Safe_iterator<_Iterator, _Sequence, > | ^~~~~~~~~~~~~ > • candidate expects 3 arguments, 2 provided > In file included from /usr/include/c++/16/debug/unordered_map:54: > • candidate 4: ‘template bool __gnu_debug::__valid_range(const _Safe_local_iterator<_Iterator, _Sequence>&, const _Safe_local_iterator<_Iterator, _Sequence>&, typename _Distance_traits<_Iterator>::__type&)’ > /usr/include/c++/16/debug/safe_local_iterator.h:415:5: > 415 | __valid_range(const _Safe_local_iterator<_Iterator, _UContainer>& __first, > | ^~~~~~~~~~~~~ > • candidate expects 3 arguments, 2 provided > • candidate 5: ‘template constexpr bool __gnu_debug::__valid_range(const _Safe_iterator<_Iterator, _Sequence, _Category>&, const _Safe_iterator<_Iterator, _Sequence, _Category>&)’ > /usr/include/c++/16/debug/safe_iterator.h:1134:5: > 1134 | __valid_range(const _Safe_iterator<_Iterator, _Sequence, > | ^~~~~~~~~~~~~ > • template argument deduction/substitution failed: > • mismatched types ‘const __gnu_debug::_Safe_iterator<_Iterator, _Sequence, _Category>’ and ‘const unsigned char*’ > /usr/include/c++/16/span:196:11: > 196 | { __glibcxx_requires_valid_range(__first, __last); } > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > • candidate 6: ‘template bool __gnu_debug::__valid_range(const _Safe_local_iterator<_Iterator, _Sequence>&, const _Safe_local_iterator<_Iterator, _Sequence>&)’ > /usr/include/c++/16/debug/safe_local_iterator.h:422:5: > 422 | __valid_range(const _Safe_local_iterator<_Iterator, _UContainer>& __first, > | ^~~~~~~~~~~~~ > • template argument deduction/substitution failed: > • mismatched types ‘const __gnu_debug::_Safe_local_iterator<_Iterator, _Sequence>’ and ‘const unsigned char*’ > /usr/include/c++/16/span:196:11: > 196 | { __glibcxx_requires_valid_range(__first, __last); } > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > • candidate 7: ‘template constexpr bool __gnu_debug::__valid_range(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorL>&, typename _Distance_traits<_Iterator>::__type&)’ > /usr/include/c++/16/debug/stl_iterator.h:40:5: > 40 | __valid_range(const std::reverse_iterator<_Iterator>& __first, > | ^~~~~~~~~~~~~ > • candidate expects 3 arguments, 2 provided > • candidate 8: ‘template constexpr bool __gnu_debug::__valid_range(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&, typename _Distance_traits<_Iterator>::__type&)’ > /usr/include/c++/16/debug/stl_iterator.h:104:5: > 104 | __valid_range(const std::move_iterator<_Iterator>& __first, > | ^~~~~~~~~~~~~ > • candidate expects 3 arguments, 2 provided > compilation terminated due to -fmax-errors=1. https://inbox.sourceware.org/gdb-patches/20261120201510.3162938-1-simon.marchi@efficios.com/T/#mf81c56bab1336128cbfae7cfd1b5ae78626443ea Simon