From patchwork Wed Oct 28 22:39:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 40910 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 D5B41384BC11; Wed, 28 Oct 2020 22:40:15 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id CF4A53861011 for ; Wed, 28 Oct 2020 22:40:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CF4A53861011 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: 2tCFIuoa9daqYB8JTNql0w3cIwCO0hwRtH5bjhuN7Uu3VzWrSzz1opZrtvIpKC6bNSOsqAWU9c 1skAIhJkwTxryJCxGrafgAJ1WmSq3CW5TPWxUO1fQVAaWROklg1JYUYAzBI6JVCQ8BGbCkTI+P Q2ij40r+hDdIM2q0jdMzF0wuUs79r2S3oS+iNnTdx3G1tBdGwec1CPL7vaGh1zJK68QdL8UqyR 6cyCessgAKHkeosCq9HBXNuPvtgelbb6lRJOJYOJ1CINLhH8dmBVCtDa+pTeHZHe7LioaJqzKQ 7g0= X-IronPort-AV: E=Sophos;i="5.77,428,1596528000"; d="scan'208";a="54450483" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 28 Oct 2020 14:40:02 -0800 IronPort-SDR: sZaTuo7rZriDcndaQFCbJsyM5pPmdGoCFOrS2p12ULEZ8DkYnbiZ+GjW+T+YRe6CP6TOjS/LV0 lF+JUhmkREQ4MAcRSNAYqtlmH3P9xFb0tHvoxYRxa+n4h42FVyYEFLnnmvluJsT4062poWmjWS T9HDX/HDtZY4R17J6xUmiI3NWBMR8IodN1aRB8HE/m4/JEfVhkl3LGBPxrfgk69UdkXmMaaFMO 8hUk8kGdxtF1B5riNU+ER2nM4IIGd2v/DMIqF6JoiPN0yF419TjGiPh5525fVm18CBN4pAt2On HPk= Date: Wed, 28 Oct 2020 22:39:57 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: Disable spurious -Warray-bounds for ypclnt.c (bug 26687) Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3131.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, 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: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Included among the GCC 11 warnings listed in bug 26687, but not fixed when that bug was marked as FIXED, are -Warray-bounds warnings in nis/ypclnt.c. These are all for different calls to the same piece of code, which already has a comment explaining that the element accessed is in a common prefix of the various structures. On the basis of that comment, this patch treats the warning as a false positive and disables it for that code. Tested with build-many-glibcs.py for arm-linux-gnueabi, where, together with my previous two patches, this allows the build of glibc to complete with GCC 11 (not yet tested whether further build failures appear in the testsuite). diff --git a/nis/ypclnt.c b/nis/ypclnt.c index ada08bf..898f814 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -30,6 +30,7 @@ #include #include #include +#include /* This should only be defined on systems with a BSD compatible ypbind */ #ifndef BINDINGDIR @@ -368,12 +369,19 @@ do_ypcall_tr (const char *domain, u_long prog, xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp) { int status = do_ypcall (domain, prog, xargs, req, xres, resp); + DIAG_PUSH_NEEDS_COMMENT; + /* This cast results in a warning that a ypresp_val is partly + outside the bounds of the actual object referenced, but as + explained below only the stat element (in a common prefix) is + accessed. */ + DIAG_IGNORE_NEEDS_COMMENT (11, "-Warray-bounds"); if (status == YPERR_SUCCESS) /* We cast to ypresp_val although the pointer could also be of type ypresp_key_val or ypresp_master or ypresp_order or ypresp_maplist. But the stat element is in a common prefix so this does not matter. */ status = ypprot_err (((struct ypresp_val *) resp)->stat); + DIAG_POP_NEEDS_COMMENT; return status; }