From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by sourceware.org (Postfix) with ESMTPS id E3B913857C48 for ; Tue, 31 May 2022 09:46:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E3B913857C48 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f49.google.com with SMTP id h5so9810685wrb.0 for ; Tue, 31 May 2022 02:46:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=aXRTGYr+n78RPi3PLLesxW0N4H/xPy2sWViLxDQa3AM=; b=pGb+e+p/yyTCHEbURioFpTBB+a61iOq1siKgytXINrL1ySkwwxc4pqZRf12SV4VlSZ yc4QsvNxSDiAabnDSNIQtWwNDDkSN0T43LTrOe5sR9Sq+xTAuLVH9hvxvmJWpN+otmiV Uc/ntX7XrD4QkqsDj3R36cIoCNADMFKV+VpTiggz9GrARSyk2kCsBTHfd0I8ckOdyEeg G0kAIn58VjAmWqvw4HD0uJQzU134EN6gkh4nbtWsHpHq8I4j2AWb0YscxoLnfLrrunQq uW/pSXt1AhWGN9cNpqtEI4cDc6Mkjr2iPMcsBB+xpgLZs0gS5nAO5C17bwtBXuKc0Kdk F7jw== X-Gm-Message-State: AOAM532c7j8DIdAPUwYvwNXEJuG3ts0uqHt8/c4vS6VQtmJ5btpAazyQ zCakn7yUn2sSicfQC2SVgseIzP8l1n4= X-Google-Smtp-Source: ABdhPJx/WFDu4zTWLjmvs1Q3iYRPDlLH5Oyuj7w+nTnPneZz0c6fHLqeEMEDbMIGETNiHC19q9btBQ== X-Received: by 2002:a5d:5584:0:b0:210:316e:fdc4 with SMTP id i4-20020a5d5584000000b00210316efdc4mr8633066wrv.33.1653990400854; Tue, 31 May 2022 02:46:40 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id c1-20020a5d4cc1000000b002103a7c5c91sm501977wrt.43.2022.05.31.02.46.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 May 2022 02:46:39 -0700 (PDT) Message-ID: <99342989-cf95-0194-bd61-1f41292e8c72@palves.net> Date: Tue, 31 May 2022 10:46:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] gdb: Workaround stringop-overread warning in debuginfod-support.c on powerpc64 Content-Language: en-US To: Mark Wielaard , Simon Marchi , gdb-patches@sourceware.org References: <20220511225219.119067-1-mark@klomp.org> <0f5c5a76969801002e5b2f9b224e6bdc58b41c1d.camel@klomp.org> From: Pedro Alves In-Reply-To: <0f5c5a76969801002e5b2f9b224e6bdc58b41c1d.camel@klomp.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2022 09:46:47 -0000 On 2022-05-31 10:05, Mark Wielaard wrote: > + /* g++ 11.2.1 on s390x, g++q 11.3.1 on ppc64le and g++ 11 on > + hppa seem convinced url_view might be of SIZE_MAX length. > + And so complains because the length of an array can only > + be PTRDIFF_MAX. */ I wonder whether sticking in an assert so that the compiler knows the size of array, would make the warning go away: diff --git c/gdb/debuginfod-support.c w/gdb/debuginfod-support.c index 6dc08fc29b6..d6fab39eac8 100644 --- c/gdb/debuginfod-support.c +++ w/gdb/debuginfod-support.c @@ -187,6 +187,8 @@ debuginfod_is_enabled () "from the following URLs:\n")); gdb::string_view url_view (urls); + gdb_assert (url_view.size () < PTRDIFF_MAX); + while (true) { size_t off = url_view.find_first_not_of (' ');