From patchwork Thu Dec 29 12:57:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 1720041 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=tWIucITf; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NjT373dtzz23dV for ; Thu, 29 Dec 2022 23:58:27 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C307438582A4 for ; Thu, 29 Dec 2022 12:58:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C307438582A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672318704; bh=OdZJwcrTC9+ew4Y8MiWGM4S18l0h3KaFtBGQksYraYM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=tWIucITfYM7O/R5/cKx2CD9Nkks2o9WXvasNUnLyBaZwXV4lT008jGKRSxru1hsqG QKf6m8/SD0Zx1mDGxXQgyA+fkaeHNukjOn1vsewY3bFHM8UamFnm5Jb1N26UKOxdGg Rb05dM0fo8EdUQwFopGdgcTw/y9E1c98Lk9yo/N8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id C4CDB3858D33 for ; Thu, 29 Dec 2022 12:58:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C4CDB3858D33 Received: by mail-oi1-x236.google.com with SMTP id s187so17055366oie.10 for ; Thu, 29 Dec 2022 04:58:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OdZJwcrTC9+ew4Y8MiWGM4S18l0h3KaFtBGQksYraYM=; b=1ePEsF0JDy5w04bciDquE3VuojHoKXMp9oscxop+R8HVP8/6xTcb1/gitOEVTAFd4l ufmR+nQ8tp33sTruy5k+hMGsgZ5NIUcOL4JkC6rEtjW5fzRM0igF9VG8GFT6HXAG/N1z HNN4qVnoN0gCpoiXPBe0NtTJwCfZdy3Mk56OiYPgfocyzmD5Cae3rCZH+CDmIXBnzSNv ttqT94TBuq86L+LVNSDrO/UrJ7D9kOHQdg/yyDApd+hMVpFk1XutKAH/ShgK0MhZtFUs wJpX4kOpSdtv7x2ikrs3lTdJhNf59V+vT8WnWxIPPnI0cld9oZAcVa0qot0I2/+maqgi SnXg== X-Gm-Message-State: AFqh2kofRYV5ouzgip++NwLWo5FsXOm/QgD3K89ES+ZK2ap8eFmRKELs gBpyDqOfXPtoZdQbFf7rPpWYoc2xGCl2jw/eD0s= X-Google-Smtp-Source: AMrXdXtX+VP44PG/FVIGXTEPEr4yIK/D5H8+ssbiFyCqgcuZKmE4cLV6acDBsjk/n4byMxVNuXiGmQ== X-Received: by 2002:a05:6808:200d:b0:35e:823e:87a6 with SMTP id q13-20020a056808200d00b0035e823e87a6mr16812739oiw.50.1672318688672; Thu, 29 Dec 2022 04:58:08 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c3:dd36:4794:7acd:a716:7b01]) by smtp.gmail.com with ESMTPSA id j2-20020a9d7d82000000b0066c34486aa7sm8977378otn.73.2022.12.29.04.58.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 04:58:07 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 1/4] locale: Use correct buffer size for utf8_sequence_error [BZ #19444] Date: Thu, 29 Dec 2022 09:57:59 -0300 Message-Id: <20221229125802.2715435-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221229125802.2715435-1-adhemerval.zanella@linaro.org> References: <20221229125802.2715435-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The buffer used by snprintf might not be large enough for all possible inputs, as indicated by gcc with -O1: ../locale/programs/linereader.c: In function ‘utf8_sequence_error’: ../locale/programs/linereader.c:713:58: error: ‘%02x’ directive output may be truncated writing between 2 and 8 bytes into a region of size between 1 and 13 [-Werror=format-truncation=] 713 | snprintf (buf, sizeof (buf), "0x%02x 0x%02x 0x%02x 0x%02x", | ^~~~ ../locale/programs/linereader.c:713:34: note: directive argument in the range [0, 2147483647] 713 | snprintf (buf, sizeof (buf), "0x%02x 0x%02x 0x%02x 0x%02x", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../locale/programs/linereader.c:713:5: note: ‘snprintf’ output between 20 and 38 bytes into a destination of size 30 713 | snprintf (buf, sizeof (buf), "0x%02x 0x%02x 0x%02x 0x%02x", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | ch1, ch2, ch3, ch4); | ~~~~~~~~~~~~~~~~~~~ Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell --- locale/programs/linereader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 0460074a0c..794f25a6e4 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -701,7 +701,7 @@ static bool utf8_sequence_error (struct linereader *lr, uint8_t ch1, int ch2, int ch3, int ch4) { - char buf[30]; + char buf[38]; if (ch2 < 0) snprintf (buf, sizeof (buf), "0x%02x", ch1); From patchwork Thu Dec 29 12:58:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 1720043 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=NRxr1gy5; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NjT3v4vyBz23dV for ; Thu, 29 Dec 2022 23:59:07 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A387F3858CDA for ; Thu, 29 Dec 2022 12:59:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A387F3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672318745; bh=GPDs69iUO1vEzzFJS8fxlUpNUaYMNDNQh4+2pNfCkX8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NRxr1gy5Puc3ePND1l+u5DX9CPH07Fmj51OTZGFcOzxAyQmU+l2yfNJSmppcEmJ8n obg2ZMjTdcZL15qVriLemGqtMrfhY5yMczHiFTU/qx4fq5oxyMiqRcclLxs9ZE7KT0 fGpYpw8P8dZkmBHlQJIp6UDjYvN0GvkRzNSX3JGU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id 086473858D35 for ; Thu, 29 Dec 2022 12:58:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 086473858D35 Received: by mail-oi1-x236.google.com with SMTP id r205so17067442oib.9 for ; Thu, 29 Dec 2022 04:58:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GPDs69iUO1vEzzFJS8fxlUpNUaYMNDNQh4+2pNfCkX8=; b=XcdRo40XIqiY6Duw36Sf0BlP+SOAoTGIEFHAohNqgw9H1wYkI8gvdPP9RZQkYEjijR NbgBCOwlepeFuFm0bbRK5dhaKCO3Zn+HvNVIlw6EgKFRx4OYPzyxYoGL1Ak7YiXhArtT Vzutat/Q83oX1NETF+EMchFtH0A2urfhCOlEWEm8bHkOX3/xabD0yExPa8fKxehC2dge u/SQqbtUAss0QPbMQcGL1c7EXNllH4BedeMump1XhVLerdXYT7kK1Qh5cUpHFrFlTF7n 3+azS1v69BL7XxrMVcRZPLsOEQ4hJKpJerqO1VCsuY6mMfv/8VNVZ5HegOggMWKqt5Tl TzGA== X-Gm-Message-State: AFqh2kpu+0WhJMrxZtW1/YvP6tZ8nMzGfjfpwO/4Ds4yRiSPiuPoTlPb aOZTsFtYiH3TfV5QA+2EGdNhCSfub2ST4QZabbo= X-Google-Smtp-Source: AMrXdXu6pAFHbcJ3REpk8qMSXt6CHcJwNLwb85uIlkVfqmV8B9RKKCI+yDu3Acy85riR92KZVrOiRw== X-Received: by 2002:a05:6808:19aa:b0:35c:3a6e:bc34 with SMTP id bj42-20020a05680819aa00b0035c3a6ebc34mr18745186oib.57.1672318690241; Thu, 29 Dec 2022 04:58:10 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c3:dd36:4794:7acd:a716:7b01]) by smtp.gmail.com with ESMTPSA id j2-20020a9d7d82000000b0066c34486aa7sm8977378otn.73.2022.12.29.04.58.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 04:58:09 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 2/4] sunrpc: Suppress GCC -O1 warning on user2netname [BZ #19444] Date: Thu, 29 Dec 2022 09:58:00 -0300 Message-Id: <20221229125802.2715435-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221229125802.2715435-1-adhemerval.zanella@linaro.org> References: <20221229125802.2715435-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The same issue described by 6128e82ebe973163d2dd614d31753c88c0c4d645 also happend with -O1. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell --- sunrpc/netname.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sunrpc/netname.c b/sunrpc/netname.c index c1d1c43e50..a10591c071 100644 --- a/sunrpc/netname.c +++ b/sunrpc/netname.c @@ -49,10 +49,11 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid, if ((strlen (dfltdom) + OPSYS_LEN + 3 + MAXIPRINT) > (size_t) MAXNETNAMELEN) return 0; - /* GCC with -Os warns that sprint might overflow while handling dfltdom, - however the above test does check if an overflow would happen. */ + /* GCC with -Os or -O1 warns that sprint might overflow while handling + dfltdom, however the above test does check if an overflow would + happen. */ DIAG_PUSH_NEEDS_COMMENT; - DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wformat-overflow"); + DIAG_IGNORE_NEEDS_COMMENT (8, "-Wformat-overflow"); sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom); DIAG_POP_NEEDS_COMMENT; i = strlen (netname); From patchwork Thu Dec 29 12:58:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 1720042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=NNtVILjb; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NjT3B5kMHz23dV for ; Thu, 29 Dec 2022 23:58:30 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C57DF3857365 for ; Thu, 29 Dec 2022 12:58:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C57DF3857365 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672318708; bh=j4GBWikrGhQajlpbg4R8r/HgOK4nzXa6a5mL6P+mTOI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NNtVILjbUAYkpRZXaKx0KjdVBvUJenYpSFmOV2U4EULzTXN5rqeml09LmYw7CZ67q gWgXRdWU6kwdfJlz+g5LtcY+0kFIOy8yDoQPGP5xhF5BiYDcTdhvLnzkoJ2QZonERK 0YUpaCDF36+uyvX3adg2EiTH8RJOyfo/BrxHj8fc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 56C26385842B for ; Thu, 29 Dec 2022 12:58:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 56C26385842B Received: by mail-ot1-x32a.google.com with SMTP id v15-20020a9d69cf000000b006709b5a534aso11418576oto.11 for ; Thu, 29 Dec 2022 04:58:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j4GBWikrGhQajlpbg4R8r/HgOK4nzXa6a5mL6P+mTOI=; b=UGGOMjZipfMU9+Q+IsALb3q8lxBtbMuV/PUuCg+h5mrnVr2sd+rp+G27YIbC/fqxMU jSWQvWEOvV3hN186yHr+uptuGGpau47y5ZiuByXkn5DwOiPy8HohWwNXOPTIe7VWHozS zyGo0DAiTeHp2Q7ovEQOMc7clAsGm6nOiPo76ASyFfj0ntQkOhPeqlKLuh3PzSFa658F Uw+hRnZNAIhEbHNmUNFrMRdT8vA9Wc1tehyVFDiR2POwUxgynLEv3o4RvSJuaBDC9RkQ EgPRdZlwJYQAHkWHrVtnMdRooPUQbOtE/XQFq8p86AjAHUKhHTGjLmGdfIZJg7eTPdm9 suNA== X-Gm-Message-State: AFqh2krGQKE9ptkoabSyl6C1BtutIJPOkAhHCTb2t0Q0vLmAtI/lHKUO /FLBIgdPpWTyYuG5PFFT1H32xxaoEfHuqA0k+Vg= X-Google-Smtp-Source: AMrXdXsGg+/K1ZaWLhsxT/fWQhhub2N07aS4g2x1pV+nmbOZaDsrR2esnf/9oHe8JXyW0PxiICK/hQ== X-Received: by 2002:a05:6830:124d:b0:66e:9510:1da5 with SMTP id s13-20020a056830124d00b0066e95101da5mr15784013otp.8.1672318691965; Thu, 29 Dec 2022 04:58:11 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c3:dd36:4794:7acd:a716:7b01]) by smtp.gmail.com with ESMTPSA id j2-20020a9d7d82000000b0066c34486aa7sm8977378otn.73.2022.12.29.04.58.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 04:58:11 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 3/4] string: Suppress -Wmaybe-unitialized for wordcopy [BZ #19444] Date: Thu, 29 Dec 2022 09:58:01 -0300 Message-Id: <20221229125802.2715435-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221229125802.2715435-1-adhemerval.zanella@linaro.org> References: <20221229125802.2715435-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" With GCC 6+ when compiling with -O1 warns that some MERGE macro usage might be used uninitialized. The issue is calling the function with len equal to 0 is undefined since the first 'switch' will not trigger any case and then subsequent loop will potentially use uninitialized variables. However all usages on mem routines always called the function for sizes larger than OP_T_THRES. --- string/wordcopy.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/string/wordcopy.c b/string/wordcopy.c index d05718322c..3b6344115d 100644 --- a/string/wordcopy.c +++ b/string/wordcopy.c @@ -18,8 +18,19 @@ /* BE VERY CAREFUL IF YOU CHANGE THIS CODE...! */ +#include #include +#include +/* With GCC 6 when compiling with -O1 warns that some MERGE macro usage might + be used uninitialized. The issue is calling the function with len equal to + 0 is undefined since the first 'switch' will not trigger any case and then + subsequent loop will potentially use uninitialized variables. However all + usages on mem routines always called the function for sizes larger than + OP_T_THRES. */ +DIAG_PUSH_NEEDS_COMMENT; +DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized"); #include +DIAG_POP_NEEDS_COMMENT; /* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to block beginning at DSTP with LEN `op_t' words (not LEN bytes!). @@ -94,7 +105,11 @@ WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len) { do8: a0 = ((op_t *) srcp)[0]; + /* Check the comment on memcopy.h inclusion. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized"); ((op_t *) dstp)[0] = a1; + DIAG_POP_NEEDS_COMMENT; do7: a1 = ((op_t *) srcp)[1]; ((op_t *) dstp)[1] = a0; @@ -291,7 +306,11 @@ WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len) { do8: a0 = ((op_t *) srcp)[7]; + /* Check the comment on memcopy.h inclusion. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized"); ((op_t *) dstp)[7] = a1; + DIAG_POP_NEEDS_COMMENT; do7: a1 = ((op_t *) srcp)[6]; ((op_t *) dstp)[6] = a0; From patchwork Thu Dec 29 12:58:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 1720048 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=bD6DY2n7; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NjT4h4lQ9z23dV for ; Thu, 29 Dec 2022 23:59:48 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A29F23858000 for ; Thu, 29 Dec 2022 12:59:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A29F23858000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672318786; bh=QZXgUzxA4k0awnCPHzZvx1yjwpEarc1F/ZDvS4dGP+8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bD6DY2n7rUt89jJMbWuxGDBAVhnvGtSWUYDAiNUNHELYt0PXgbwAUrvcj1MVl+MCp 8YGRQkldR+0q9vD49REtOqf9lmQXm+tJnSDn7qrNBZBY0s/NFV6ZA+aYBfudBrqdr2 amqzUdM2t4rRwjUGwLMe/BCyM9lhlXjR4f3zHuXE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id 25C7F385828D for ; Thu, 29 Dec 2022 12:58:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 25C7F385828D Received: by mail-oi1-x22c.google.com with SMTP id r11so17043982oie.13 for ; Thu, 29 Dec 2022 04:58:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QZXgUzxA4k0awnCPHzZvx1yjwpEarc1F/ZDvS4dGP+8=; b=MHuhp5jCi8yU010u50ZbbWtpvRtkcA/ythJydKPoaoz1Lci63n6ZvBICZbvnchMjcC gIAF9bnBLqF35vkgAyvSZp3u6g445z/EYxChZ9vTgWre5EfKcG+7lQMyBIGEVVhm8cQa bPKmRrVnyAVvr0OoUNHFDVcmCehAYg3Lnto8YLeWXYPfQvpMO/Yv+0tjGUak4g3YFzD5 Qn6jcXonWB0wYLm6w2y/BiggxPmTl33fdMYjsu6s1Hhcy+xN9S3kTGsFnLOau2ppiddp UcPNtxgYa0tY3B7QJQyaVGD1n0OLPnXlFKopGqgvZwOk6aER2KeLp2dFqtB5m+EVgCUi JAGw== X-Gm-Message-State: AFqh2kpKdzMqClq+c65VmzMuVFL+46ip0mlmPT/pHGHQ8qaE3TD8ey7o Cpy1NoUMhOShQG4Mi7ftRTE2cQ27v9D7ZF95FfU= X-Google-Smtp-Source: AMrXdXv6Y3uez1UY0ycs1Tnblv5fLDZ/gBmqBBFlS+sGVlfmj1vSZCWO3JdKUjxnb7vT9jWxLlCvSQ== X-Received: by 2002:a05:6808:485:b0:360:fc4c:cc18 with SMTP id z5-20020a056808048500b00360fc4ccc18mr13190956oid.45.1672318693829; Thu, 29 Dec 2022 04:58:13 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c3:dd36:4794:7acd:a716:7b01]) by smtp.gmail.com with ESMTPSA id j2-20020a9d7d82000000b0066c34486aa7sm8977378otn.73.2022.12.29.04.58.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 04:58:13 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 4/4] math: Suppress -O0 warnings for soft-fp fsqrt [BZ #19444] Date: Thu, 29 Dec 2022 09:58:02 -0300 Message-Id: <20221229125802.2715435-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221229125802.2715435-1-adhemerval.zanella@linaro.org> References: <20221229125802.2715435-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The patch suppress the same warnings from 87c266d758d29e52bfb717f90, that shows issues for microblaze, mips soft-fp, nios2, and or1k. Reviewed-by: Carlos O'Donell --- sysdeps/ieee754/soft-fp/s_fsqrt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sysdeps/ieee754/soft-fp/s_fsqrt.c b/sysdeps/ieee754/soft-fp/s_fsqrt.c index ef631bc6c2..d5c7904118 100644 --- a/sysdeps/ieee754/soft-fp/s_fsqrt.c +++ b/sysdeps/ieee754/soft-fp/s_fsqrt.c @@ -25,6 +25,15 @@ #undef fsqrtl #include +#include +/* R_f[01] are not set in cases where they are not used in packing, + but the compiler does not see that they are set in all cases where + they are used, resulting in warnings that they may be used + uninitialized. The location of the warning differs in different + versions of GCC, it may be where R is defined using a macro or it + may be where the macro is defined. This happens only with -O1. */ +DIAG_PUSH_NEEDS_COMMENT; +DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); #include #include #include @@ -51,4 +60,6 @@ __fsqrt (double x) CHECK_NARROW_SQRT (ret, x); return ret; } +DIAG_POP_NEEDS_COMMENT; + libm_alias_float_double (sqrt)