From patchwork Mon Oct 5 21:43:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 40667 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A7F013857C67; Mon, 5 Oct 2020 21:43:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7F013857C67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601934214; bh=JPkiZal34ckqZHPHA3Uck5R1LPVtEp6BYhHukBHMgOI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=RDxKjKYU8IxeUf9vbCXVW/YxgA/APqpI1VFNeWOwXQ+RwShRGnBFWAqf4UPFtiEEq jfg7Pc7u/CYVLF8Gp807LdidYwvGHG5TKSrbhRP60XM1/g/Kcfy1xkr0vK3YiGhI/j l7bG1ETAFGd/fyMzcl2Y9eTl9b5aaSOj8vqEqhx4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by sourceware.org (Postfix) with ESMTPS id 26C373857C4E for ; Mon, 5 Oct 2020 21:43:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 26C373857C4E Received: by mail-qt1-x82d.google.com with SMTP id q26so5799548qtb.5 for ; Mon, 05 Oct 2020 14:43:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=JPkiZal34ckqZHPHA3Uck5R1LPVtEp6BYhHukBHMgOI=; b=LFGKli8vMkFmCuyCqdGWvEmLzJUMFCI+3d/pQrFwGkQVhlW9n5/IG2YxGnXyQ1EZoY CKv9hvIpEdEm8da/46I99qCmmuzlunq7KkJM/RlK06CJUHXVbg92REtbPA23z0tJ306Y S8MC56udXalv6NZH7IIOhDFN6M/2hVIte/u+y+mlqeHVidVS3lcvzR66zpPJiDtL4l5A 3sRJf2bmhiuEddr1MvgXZzMose5RyPBzEfzuOQXYIR71MeX2yNrNTPkk86ulo/J8lAM6 HoNyildjGTXm+h/qXLiqcgb6Rwrp9RqDTDlxPs/mPW/JVKzKC16C0NIB6XwEv+Rv3Kv9 KVvg== X-Gm-Message-State: AOAM533fNK1RQKX+r6+kFOpW9O9VH21EY+GauQjcUc3ic414BN/kaTIE nuSWWVT9FQXhX0TP7LkVlEIA7IRbx+M= X-Google-Smtp-Source: ABdhPJwBFEQUnnkTYNC+ACNQ26Uh8IGNYN+u/TvdydiSGWWNAm7jPcwx3xemsxgUx4ZIXhrVFFlkkw== X-Received: by 2002:ac8:140c:: with SMTP id k12mr2131157qtj.6.1601934211625; Mon, 05 Oct 2020 14:43:31 -0700 (PDT) Received: from [192.168.0.41] (97-118-127-189.hlrn.qwest.net. [97.118.127.189]) by smtp.gmail.com with ESMTPSA id l30sm791087qta.73.2020.10.05.14.43.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Oct 2020 14:43:31 -0700 (PDT) To: GNU C Library Subject: [PATCH] adjust thread db function declarations to match definitions (BZ 26686) Message-ID: <491dac14-811a-2d17-1425-d8f400262af7@gmail.com> Date: Mon, 5 Oct 2020 15:43:30 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Martin Sebor via Libc-alpha From: Martin Sebor Reply-To: Martin Sebor Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Similar to the issue with the RPC function declarations, building Glibc with the latest GCC 11 also shows a couple of instances of the new -Warray-parameter warning in the thread db APIs. To avoid these, the attached patch changes the deefinitions of the two functions to match their definitions. I tested the patch by building Glibc with GCC trunk and confirming the warnings are gone, and by running the tests and confirming no new failures in the test suite. Martin PS The functions only appear to access the first element of the array (via the DB_DESC_SIZE() macro), so I at first thought an alternate change might be to have both their declarations and definitions take a uint32_t[1] instead. But it turns out that they call _td_locate_field with the array as an argument, and that function accesses all three elements. So declaring them to take uint32_t[1] leads to warnings about _td_locate_field accessing the array past its end. PPS Another change to consider here is to also use the [static] notation when declaring the arrays in internal functions (in public headers it would require hiding the "static" behind a macro to work with C++). It's not necessary to enable bounds checking with GCC 11 but it is with Clang. diff --git a/nptl_db/fetch-value.c b/nptl_db/fetch-value.c index 128d736adb..8f1ff74fd0 100644 --- a/nptl_db/fetch-value.c +++ b/nptl_db/fetch-value.c @@ -140,7 +140,7 @@ _td_fetch_value (td_thragent_t *ta, td_err_e _td_store_value (td_thragent_t *ta, - uint32_t desc[2], int descriptor_name, psaddr_t idx, + db_desc_t desc, int descriptor_name, psaddr_t idx, psaddr_t address, psaddr_t widened_value) { ps_err_e err; @@ -240,7 +240,7 @@ _td_fetch_value_local (td_thragent_t *ta, td_err_e _td_store_value_local (td_thragent_t *ta, - uint32_t desc[2], int descriptor_name, psaddr_t idx, + db_desc_t desc, int descriptor_name, psaddr_t idx, void *address, psaddr_t widened_value) { td_err_e terr = _td_locate_field (ta, desc, descriptor_name, idx, &address);