From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 24A293858D33; Sun, 1 May 2022 19:44:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 24A293858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: by gnu.wildebeest.org (Postfix, from userid 1000) id 1BF0D302BBED; Sun, 1 May 2022 21:44:45 +0200 (CEST) Date: Sun, 1 May 2022 21:44:45 +0200 From: Mark Wielaard To: Mark Wielaard via Overseers Cc: "gdb@sourceware.org" , Thomas Fitzsimmons , Dan =?iso-8859-1?Q?Hor=E1k?= Subject: Re: gdb builder status (Was: Adding binutils to the GNU Toolchain buildbot on sourceware) Message-ID: <20220501194445.GB30898@gnu.wildebeest.org> References: <5c1f217a-109c-2973-6c69-abf412133dee@arm.com> <524b04b7-a78c-7aae-4605-b40f61e6830c@arm.com> <16fe426d-c436-f030-dc43-0e81e7f0e853@arm.com> <20220428141957.GB23335@gnu.wildebeest.org> <20220428162803.GD23335@gnu.wildebeest.org> <20220429200422.GB7305@gnu.wildebeest.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220429200422.GB7305@gnu.wildebeest.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 May 2022 19:44:49 -0000 Hi, On Fri, Apr 29, 2022 at 10:04:22PM +0200, Mark Wielaard via Overseers wrote: > The fedora-s390x failure looks as follows: > https://builder.sourceware.org/buildbot/#/builders/gdb-fedora-s390x > > In file included from /usr/include/c++/11/string:40, > from ../../binutils-gdb/gdb/../gdbsupport/ptid.h:36, > from ../../binutils-gdb/gdb/../gdbsupport/common-defs.h:198, > from ../../binutils-gdb/gdb/defs.h:28, > from ../../binutils-gdb/gdb/debuginfod-support.c:19: > In static member function ‘static constexpr const char_type* std::char_traits::find(const char_type*, std::size_t, const char_type&)’, > inlined from ‘constexpr std::basic_string_view<_CharT, _Traits>::size_type std::basic_string_view<_CharT, _Traits>::find(_CharT, std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits]’ at /usr/include/c++/11/bits/string_view.tcc:87:41, > inlined from ‘constexpr std::basic_string_view<_CharT, _Traits>::size_type std::basic_string_view<_CharT, _Traits>::find_first_of(_CharT, std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits]’ at /usr/include/c++/11/string_view:431:26, > inlined from ‘bool debuginfod_is_enabled()’ at ../../binutils-gdb/gdb/debuginfod-support.c:194:33: > /usr/include/c++/11/bits/char_traits.h:413:62: error: ‘void* __builtin_memchr(const void*, int, long unsigned int)’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overread] > 413 | return static_cast(__builtin_memchr(__s, __a, __n)); > | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ > This is really weird. I don't know why, but for some reason g++ (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) on s390x seems convinced the string might be of SIZE_MAX lenght. And so complains because the length of an array can only be PTRDIFF_MAX. The following "fixes" it: diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c index 4ce2e786..d4f8a55c 100644 --- a/gdb/debuginfod-support.c +++ b/gdb/debuginfod-support.c @@ -190,7 +190,10 @@ debuginfod_is_enabled () size_t off = url_view.find_first_not_of (' '); if (off == gdb::string_view::npos) break; - url_view = url_view.substr (off); + /* Use PTRDIFF_MAX otherwise g++ might (wrongly) believe + the string might be SIZE_MAX and warn for specified bound + exceeding maximum object size on find. */ + url_view = url_view.substr (off, PTRDIFF_MAX); off = url_view.find_first_of (' '); gdb_printf (_(" <%ps>\n"), Is that a reasonable workaround? Thanks, Mark