From patchwork Tue Dec 3 08:50:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 1203568 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-107641-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="YjGTUCY+"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47RwgC5F41z9sP6 for ; Tue, 3 Dec 2019 19:50:47 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:mime-version:content-type :message-id; q=dns; s=default; b=risSvgsUrMxYu2xO0hPkCrOdFsWPnej fP4CNIuTtzi6TCUFAKASpahPh7fY6MVOAMil4daOVG8brPowtvgLUE6Sa6SuVOS2 2FTvLnIN6iOSKFN8UUTSde8j788aKWQMG5HqTEvH/GJboDMw/1f0FotoxO2BSOm/ +B2Vf5Mm0bq0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:mime-version:content-type :message-id; s=default; bh=MCFspSq3oKa4vN837Y2+hXqYPU0=; b=YjGTU CY+/vk9a3c5I5CV17jUng1wnBjtmYajAXTQUSnBAwXTINkPOD4zBzdm+EbWNA+j+ 6fYEsB8ngtfrl8sLrKc2+ThqimMrQbBHmeIW4UnxnmCt/ZRMF78v+TEvgmj79ywd U5+WCec4KG7MdsHLYF+RXClYsU+hdfjC00UEDQ= Received: (qmail 4052 invoked by alias); 3 Dec 2019 08:50:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 3983 invoked by uid 89); 3 Dec 2019 08:50:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2014 X-HELO: mx0a-001b2d01.pphosted.com To: GNU C Library From: Stefan Liebler Subject: [PATCH] Get rid of Werror=maybe-uninitialized in res_send.c. Date: Tue, 3 Dec 2019 09:50:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 x-cbid: 19120308-0012-0000-0000-0000037036FD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19120308-0013-0000-0000-000021ABF1D1 Message-Id: <03d65724-d69b-d553-18a5-dece072e5a45@linux.ibm.com> Hi, the commit 446997ff1433d33452b81dfa9e626b8dccf101a4 introduced this new usage of resplen. If build with gcc 9 -march>=z13 on s390x, the following warning occurs: res_send.c: In function ‘__res_context_send’: res_send.c:539:6: error: ‘resplen’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 539 | if (resplen > HFIXEDSZ) | ^ Therefore this patch adds a further DIAG_IGNORE_NEEDS_COMMENT in the same way as it was previously done for usages of resplen or n. See commit d1bc2cbbed9aea2017ef941f63c8786571da5b4f. Bye Stefan Reviewed-by: Siddhesh Poyarekar commit bfd6a9fcd4fbbd19eb67b868a27f83c801e2e725 Author: Stefan Liebler Date: Mon Dec 2 13:11:52 2019 +0100 Get rid of Werror=maybe-uninitialized in res_send.c. The commit 446997ff1433d33452b81dfa9e626b8dccf101a4 introduced this new usage of resplen. If build with gcc 9 -march>=z13 on s390x, the following warning occurs: res_send.c: In function ‘__res_context_send’: res_send.c:539:6: error: ‘resplen’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 539 | if (resplen > HFIXEDSZ) | ^ Therefore this patch adds a further DIAG_IGNORE_NEEDS_COMMENT in the same way as it was previously done for usages of resplen or n. See commit d1bc2cbbed9aea2017ef941f63c8786571da5b4f. diff --git a/resolv/res_send.c b/resolv/res_send.c index fce810031f..975985f13a 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -534,6 +534,9 @@ __res_context_send (struct resolv_context *ctx, resplen = n; + /* See comment at the declaration of n. Note: resplen = n; */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized"); /* Mask the AD bit in both responses unless it is marked trusted. */ if (resplen > HFIXEDSZ) @@ -543,6 +546,7 @@ __res_context_send (struct resolv_context *ctx, else mask_ad_bit (ctx, ans); } + DIAG_POP_NEEDS_COMMENT; if (resplen2 != NULL && *resplen2 > HFIXEDSZ) mask_ad_bit (ctx, *ansp2);