From patchwork Mon Oct 4 18:42:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1536327 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HNV3V0P6Jz9t0G for ; Tue, 5 Oct 2021 05:43:32 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBF23385843C for ; Mon, 4 Oct 2021 18:43:30 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id B17CE385843C for ; Mon, 4 Oct 2021 18:42:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B17CE385843C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: NY5F3ysoKpUFKvvoIlLbXCQqUaHTUzGoe3u5FpZamqExWpVfPsmSWSiZPuOT7uC1ezzpBAPN8G C+a9At0aCKJ31QUP2YxBKMDQg0ChEkN+MP2DA/5PbkmYqAlZa/nynpZJr5MhqOWSugO3y3eW5F rGqVArEJyWxXYcKvqnHhXYgbjk9NNuuVirDLRaauqLA3PpL2V8zvdXG3/6IMvaWXvSgaaYekKF zGG6AAa9A9vuRbNF3gJykiJzLyL/l3qHLwvxgAZkrowAX9xbvYcmHZpsPmyyzyaVmcHaSvdFPx Yd8e4ZHAOyn/ADyNX6Qs6dOT X-IronPort-AV: E=Sophos;i="5.85,346,1624348800"; d="scan'208";a="66799723" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 04 Oct 2021 10:42:27 -0800 IronPort-SDR: xPZVuRNczgztqYggZwMKJDkbBtaVng1LxLcq8aSuQGVeGbhvvW/88dCMgjZnMAfXjagY2ffurN 8UIDfyd/gRhzGTBwv1mGO2ji4i4ShVhII97A8XboYAQxrGxykSZTw4qcGCOSUNfPyLGC/1qmoL C225dfphSH1Ffcl+cFz9QrPBbKcCjQ1A63zQWPAEtEhwmLSzXemS+dwf52ehDckSy5Z/SuXtkj IMCVTGjmP9tIecc84DmmnwhnetBHH/vmB6DIjOtq0WvxFjdM8I9xPQw2/8k3tLt9PKGm+QYFIh mPE= Date: Mon, 4 Oct 2021 18:42:21 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: Fix stdio-common tests for GCC 12 -Waddress 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-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3123.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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" My glibc bot shows failures building the testsuite with GCC mainline across all architectures: tst-vfprintf-width-prec.c: In function 'do_test': tst-vfprintf-width-prec.c:90:16: error: the comparison will always evaluate as 'false' for the address of 'result' will never be NULL [-Werror=address] 90 | if (result == NULL) | ^~ tst-vfprintf-width-prec.c:89:13: note: 'result' declared here 89 | wchar_t result[100]; | ^~~~~~ This is clearly a correct warning; the comparison against NULL is clearly a cut-and-paste mistake from an earlier case in the test that does use calloc. Thus, remove the unnecessary check for NULL shown up by the warning. Similarly, two other tests have bogus comparisons against NULL; remove those as well: scanf14a.c:95:13: error: the comparison will always evaluate as 'false' for the address of 'fname' will never be NULL [-Werror=address] 95 | if (fname == NULL) | ^~ scanf14a.c:93:8: note: 'fname' declared here 93 | char fname[strlen (tmpdir) + sizeof "/tst-scanf14.XXXXXX"]; | ^~~~~ scanf16a.c:125:13: error: the comparison will always evaluate as 'false' for the address of 'fname' will never be NULL [-Werror=address] 125 | if (fname == NULL) | ^~ scanf16a.c:123:8: note: 'fname' declared here 123 | char fname[strlen (tmpdir) + sizeof "/tst-scanf16.XXXXXX"]; | ^~~~~ Tested with build-many-glibcs.py (GCC mainline) for aarch64-linux-gnu. Reviewed-by: Adhemerval Zanella diff --git a/stdio-common/scanf14a.c b/stdio-common/scanf14a.c index 12adcff5a4..b37712d1c6 100644 --- a/stdio-common/scanf14a.c +++ b/stdio-common/scanf14a.c @@ -92,8 +92,6 @@ main (void) char fname[strlen (tmpdir) + sizeof "/tst-scanf14.XXXXXX"]; sprintf (fname, "%s/tst-scanf14.XXXXXX", tmpdir); - if (fname == NULL) - FAIL (); /* Create a temporary file. */ int fd = mkstemp (fname); diff --git a/stdio-common/scanf16a.c b/stdio-common/scanf16a.c index 400d85a54e..74d0295c97 100644 --- a/stdio-common/scanf16a.c +++ b/stdio-common/scanf16a.c @@ -122,8 +122,6 @@ main (void) char fname[strlen (tmpdir) + sizeof "/tst-scanf16.XXXXXX"]; sprintf (fname, "%s/tst-scanf16.XXXXXX", tmpdir); - if (fname == NULL) - FAIL (); /* Create a temporary file. */ int fd = mkstemp (fname); diff --git a/stdio-common/tst-vfprintf-width-prec.c b/stdio-common/tst-vfprintf-width-prec.c index 3192fd797a..278d57f739 100644 --- a/stdio-common/tst-vfprintf-width-prec.c +++ b/stdio-common/tst-vfprintf-width-prec.c @@ -87,12 +87,6 @@ do_test (void) } { wchar_t result[100]; - if (result == NULL) - { - printf ("error: calloc (%d, %zu): %m", ret + 1, sizeof (wchar_t)); - return 1; - } - ret = swprintf (result, 100, L"%133000.999999999x", 17); if (ret >= 0) {