From patchwork Wed Sep 21 13:51:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 57845 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 792BE3857814 for ; Wed, 21 Sep 2022 13:51:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 792BE3857814 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663768308; bh=mzgatIN4FW972MjjKNR65A0ixgYtxq0aUlH24MTvBss=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=KI+/Uf9MOrw5rim5cxWueZysv90YGdITW/uULEjX9/lvhDVWmtt13uLpk4ruLCz8T NJKHQmDTFmh4DvP4MSu61LdWvieeCtzXO0Pr1eX90Tn3jVwSK2smTUwC+xnZD0+3vW E8Y0Tl3ng7uV8a0XyN1FnYSwDvUVB6+s+b9XqpFY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 5DAD5385840F for ; Wed, 21 Sep 2022 13:51:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5DAD5385840F Received: by mail-ot1-x335.google.com with SMTP id x23-20020a056830409700b00655c6dace73so3960062ott.11 for ; Wed, 21 Sep 2022 06:51:21 -0700 (PDT) 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=mzgatIN4FW972MjjKNR65A0ixgYtxq0aUlH24MTvBss=; b=ZEfcnPE4NBJayLJr5aCl2Lv81+tm7hHpfRKrRqLOm00FluLdaCAVSs6KkXNdAodMqv fnVW0JetctiZxtHLDm7GS7ezZPR9zOqDXCGfOH9+CPE4jDL1dxaQCVPx0oKJs9HvujEF wppPi4ZPvbXAup7pWe3XxnoQB9WFMWe+dZP/a3Q2HLC+t48AroELgiouyLIMhv93wAwP iQhEWSzR+ewJfXUXgLzGhxuYfFsoQvlDEd4TsT0AH/QvneJd76GgQFxSNdpqEsUTfe0n FBOTi7CwxxnTM9KBl7waxBJ15tVt9u65umKCL9MXTMOSCJFIhi9J38frOfC2isTC/Om3 XAsw== X-Gm-Message-State: ACrzQf0JXz6xUT9vdpu0yhZdlP9T+d1DOAwIgqY7T26PCj7RWrRS2zX2 Gdn4n+mXimlFIqt4kGdpE9VVJ2rGP4/5dTVg X-Google-Smtp-Source: AMsMyM73Zb69jKnh+9DqdwF5RXt4r9tvAo9hnciTUJ9ScjzyvXHmr10jJcnvT6hepDNJLZy88YdyDA== X-Received: by 2002:a9d:71cf:0:b0:655:b919:4f41 with SMTP id z15-20020a9d71cf000000b00655b9194f41mr12399326otj.358.1663768280568; Wed, 21 Sep 2022 06:51:20 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:c266:dbbf:9e84:6582:5289]) by smtp.gmail.com with ESMTPSA id a38-20020a05687046a600b0010bf07976c9sm1669476oap.41.2022.09.21.06.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 06:51:20 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 1/6] locale: prevent maybe-uninitialized errors with -Os [BZ #19444] Date: Wed, 21 Sep 2022 10:51:03 -0300 Message-Id: <20220921135108.3324737-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> References: <20220921135108.3324737-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 Netto Reply-To: Adhemerval Zanella Cc: Martin Jansa Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" From: Martin Jansa Fixes following error when building with -Os: | In file included from strcoll_l.c:43: | strcoll_l.c: In function '__strcoll_l': | ../locale/weight.h:31:26: error: 'seq2.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] | int_fast32_t i = table[*(*cpp)++]; | ^~~~~~~~~ | strcoll_l.c:304:18: note: 'seq2.back_us' was declared here | coll_seq seq1, seq2; | ^~~~ | In file included from strcoll_l.c:43: | ../locale/weight.h:31:26: error: 'seq1.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized] | int_fast32_t i = table[*(*cpp)++]; | ^~~~~~~~~ | strcoll_l.c:304:12: note: 'seq1.back_us' was declared here | coll_seq seq1, seq2; | ^~~~ Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- locale/weight.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/locale/weight.h b/locale/weight.h index 8be2d220f8..4a4d5aa6b2 100644 --- a/locale/weight.h +++ b/locale/weight.h @@ -27,7 +27,14 @@ findidx (const int32_t *table, const unsigned char *extra, const unsigned char **cpp, size_t len) { + /* With GCC 8 when compiling with -Os the compiler warns that + seq1.back_us and seq2.back_us might be used uninitialized. + This uninitialized use is impossible for the same reason + as described in comments in locale/weightwc.h. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); int32_t i = table[*(*cpp)++]; + DIAG_POP_NEEDS_COMMENT; const unsigned char *cp; const unsigned char *usrc; From patchwork Wed Sep 21 13:51:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 57849 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 877163857B95 for ; Wed, 21 Sep 2022 13:53:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 877163857B95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663768384; bh=BgR3rJaxPhfe5gwTkJog0BtyctPMkktmC2RECKAiDjQ=; 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=lUg0RQ3f8WgB2ovgkyLIVcnGuxqOHSOAiAWcu12n+Yn37Ai8A2vZZAGjoEXSIdRvZ CVmffqSCJ2Mqs6vNDhfyh426XOD/hvEex28GvqnmQGlHtVuOXL7RwsZdlwHftmfR6N nzIHPpY3wwhKjGJzoIVxtCEUBksKPWHF03/SCrZk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by sourceware.org (Postfix) with ESMTPS id C919238582B2 for ; Wed, 21 Sep 2022 13:51:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C919238582B2 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-11e9a7135easo9115973fac.6 for ; Wed, 21 Sep 2022 06:51:22 -0700 (PDT) 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; bh=BgR3rJaxPhfe5gwTkJog0BtyctPMkktmC2RECKAiDjQ=; b=t+TYYVHXS1ffPxvLE9m1cE9lmHe6Wl/wDtE+qiKtfmkEFCZCrVWgyqZw9cXbW6cCwU 4b8PiScjEofoQLMzvuZELhUJzUYUZXb/lC7/1Iox5yChGNbbj5IOS2sp0OciGaVUKCP+ fNgdTZyse3AsU+70j1ayih03Xft6FD2FIiOod7e1K/S450AQqNbXtCFG+hPf6z3qQfHB jNDGdx4BCRFpotgx5lXnHF5AjqhHN6bvQiDiD31E/cxNc5upSv3rlI/vgnPQKQNRGDub 7CpwnjVzTYkznsIoB/4khr7Rb7RvPbWCRRbdwsy3WhJ3wfsjMKGRwfzAq7Q4NQKjMNZS nBZA== X-Gm-Message-State: ACrzQf2V7lZHRbVbdnbpndnLC6lPV2AtAw2Yy9JnrQb55ugWtaVrsm/d g23Y26MQ8DffhjJ49H/mskgsVj82FI179A/w X-Google-Smtp-Source: AMsMyM6OPxCClegYTcGUuToYjZOiZOYNGJXZ/0YFmy/+qhyGgg7yG+OaFMUdg+ZdHATrH3rLKCgw2w== X-Received: by 2002:a05:6870:562c:b0:127:bbe4:3f35 with SMTP id m44-20020a056870562c00b00127bbe43f35mr5244087oao.284.1663768281671; Wed, 21 Sep 2022 06:51:21 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:c266:dbbf:9e84:6582:5289]) by smtp.gmail.com with ESMTPSA id a38-20020a05687046a600b0010bf07976c9sm1669476oap.41.2022.09.21.06.51.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 06:51:21 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 2/6] posix: Suppress -Os warnings on fnmatch Date: Wed, 21 Sep 2022 10:51:04 -0300 Message-Id: <20220921135108.3324737-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> References: <20220921135108.3324737-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 Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" GCC with -Os issues some may uninitialized warnings on fnmatch code. All of the variables are already set when they are accessed on the loop prior. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- posix/fnmatch_loop.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c index 9445ed9c58..23eeffc79c 100644 --- a/posix/fnmatch_loop.c +++ b/posix/fnmatch_loop.c @@ -530,6 +530,14 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, { /* Compare the byte sequence but only if this is not part of a range. */ + + /* The compiler might warn that idx may be + used uninitialized, however it will be + reached iff elem < table_size which means + that it was properly set in the loop + above. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); if (! is_range # if WIDE_CHAR_VERSION @@ -542,11 +550,19 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, n += c1 - 1; goto matched; } + DIAG_POP_NEEDS_COMMENT; /* Get the collation sequence value. */ is_seqval = true; # if WIDE_CHAR_VERSION + /* The compile might warn that wextra may be + used uninitialized and similar to 'idx' + above it will be properly set by the loop. + */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); cold = wextra[1 + wextra[0]]; + DIAG_POP_NEEDS_COMMENT; # else idx += 1 + extra[idx]; /* Adjust for the alignment. */ @@ -723,9 +739,24 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, /* Get the collation sequence value. */ is_seqval = true; # if WIDE_CHAR_VERSION + /* The compiler might warn that wextra may + be used uninitialized, however it will + be reached iff elem < table_size which + means that it was properly set in the + loop above. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); cend = wextra[1 + wextra[0]]; + DIAG_POP_NEEDS_COMMENT; # else + /* The compile might warn that idx may + be used uninitialized and similar to + wextra above it will be properly set by + the loop. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); idx += 1 + extra[idx]; + DIAG_POP_NEEDS_COMMENT; /* Adjust for the alignment. */ idx = (idx + 3) & ~3; cend = *((int32_t *) &extra[idx]); From patchwork Wed Sep 21 13:51:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 57846 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 44C6B3857B9C for ; Wed, 21 Sep 2022 13:51:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44C6B3857B9C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663768319; bh=CE1k8Onsa/tQDOXcHL+21MrbamO/Z8q+UjMxt9koZp0=; 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=blr1VVPuYqtzJSO1XcrVex/ly5w7XdSRhykupHByxo7iWkUfFdD8mqHS3NRD5cXrc QY8zFWokidCnzSkYeislGusjNfZbxJ3C6OkTJka7AgJ5Iup5/RCGjAOSB3YEjY3BHA AUviH2rS0b8ShwIcNAyjqFfvdC1uhZv/XHkqOkao= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id A7B0238582BC for ; Wed, 21 Sep 2022 13:51:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7B0238582BC Received: by mail-oi1-x232.google.com with SMTP id j188so8185370oih.0 for ; Wed, 21 Sep 2022 06:51:23 -0700 (PDT) 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; bh=CE1k8Onsa/tQDOXcHL+21MrbamO/Z8q+UjMxt9koZp0=; b=m9d0GDuj6aBfQHp03lLkQXLSSojkKAmDfEN7XNdCRvLnTdBEfegaGPJX7dvXwAi490 OVz19rqDPrH1pzOTmXcdXje1UfbmtMJOB6WkLSOCMpQFQpHFRBXWy2nM1ssFsTWcc3Q6 atbVfetnqxeUuhiaL1J3M+BrDBx2b3uDIehT/gBo2aXMBANANua6Q539UK6UasNFgKk3 qVU/3T31IXcZNFW7XqiWTF2UAtAyO9xMiOQy7Lh8Yt81IyZ3Os5SkQnE379LgkqFfdRe EoJvrcnfdprvPffpUNVdAWckFKqzWXbG4gjeWEcRbfvF2SqkRrSYFRqNz/tjeFklN+Hn UYMw== X-Gm-Message-State: ACrzQf3iHduhYN0+MosuSuKau2+4K+yLY91LmOHPyQzMnHOZZt/5NjgC WyTEnLxmGQe70AHQbgWzyLrHY7dzb3kcQVgN X-Google-Smtp-Source: AMsMyM5Mrc/whNRMFQrXO+LvXul6R9Ufu6UzvACZycJVigCNAIIavP80I3Nint3d5TTVWfsfdExO5A== X-Received: by 2002:a05:6808:1597:b0:350:4f39:d7d2 with SMTP id t23-20020a056808159700b003504f39d7d2mr3743450oiw.125.1663768282808; Wed, 21 Sep 2022 06:51:22 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:c266:dbbf:9e84:6582:5289]) by smtp.gmail.com with ESMTPSA id a38-20020a05687046a600b0010bf07976c9sm1669476oap.41.2022.09.21.06.51.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 06:51:22 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 3/6] posix: Suppress -Os may be used uninitialized warnings on regexec Date: Wed, 21 Sep 2022 10:51:05 -0300 Message-Id: <20220921135108.3324737-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> References: <20220921135108.3324737-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 Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" GCC with -Os issues may uninitialized warnings on regexec code. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- posix/regexec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/posix/regexec.c b/posix/regexec.c index cffeaf2845..386a757f35 100644 --- a/posix/regexec.c +++ b/posix/regexec.c @@ -3768,7 +3768,13 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx, _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); for (i = 0; i < cset->ncoll_syms; ++i) { + /* The compiler might warn that extra may be used uninitialized, + however the loop will be executed iff ncoll_syms is larger + than 0,which means extra will be already initialized. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized"); const unsigned char *coll_sym = extra + cset->coll_syms[i]; + DIAG_POP_NEEDS_COMMENT; /* Compare the length of input collating element and the length of current collating element. */ if (*coll_sym != elem_len) From patchwork Wed Sep 21 13:51:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 57847 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 DD0793857355 for ; Wed, 21 Sep 2022 13:52:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD0793857355 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663768324; bh=NxZEpTFykwmNf3Ulz0NTZy9CR+0r/6/jwP4YIAgDdpI=; 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=CcmxY3WtLPiNuQGXf0adikDGfY6yZdPL5zma6B2RPOZxlNDxrgfa+LbpoprEkYP8X 3LVh7Zw4Cj1bs9z1mOzTjlRwn+5XzZcEVOi6fsiCx52JWhh/uNGpMuJ2PjNG867jNb qlgMQwKDVijghAKWPYKbzp1h6XGuiMS7BTC7pEw8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id CACE4385829B for ; Wed, 21 Sep 2022 13:51:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CACE4385829B Received: by mail-oi1-x22f.google.com with SMTP id d64so5104452oia.9 for ; Wed, 21 Sep 2022 06:51:24 -0700 (PDT) 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; bh=NxZEpTFykwmNf3Ulz0NTZy9CR+0r/6/jwP4YIAgDdpI=; b=f+TnoNkp/B6sJ4rT31MKfmyW27NGXRmOpO2gamsbEuqQTgFfVMwPsA2Qp9YXipJJ7A NsNeR1KdELgip4U/62wmZoKU/7kjghIfNJOEEGHCitE+AC1Qabe3N8tjoFYjuO1XayH6 BkUozEdR8d/CCH1gY1f2zedRmNpUAmv4DAShWnigQ0ShD/sv73/5Vf0uuZYgVYZfSMP+ 79A2WrotjAVtgaINDggwCZi2zkcy0gntfI6Pitzbmj2GQ2Dce6bRXQWL8q55zvAy+fyr r2hUNNc5Y2V2YWlit8tZcBaw9HtjjbMAgbTxhc7vghX83IuQqhgb2TbBj5cSXpttueiQ klRQ== X-Gm-Message-State: ACrzQf24sWVW+zD0KgERhq2ioWYbOhzG9A7IKxcA7vK3PNcLdpZlKD97 miBqvb7Sn+7sSDO6xGurAS377qkquIJlQflS X-Google-Smtp-Source: AMsMyM5gtTgappgpI8mhFzTKNuTaoeB4KedbnvRR5KCuS8Z797zuFxgZZdoHs7XF7XAVC2dD5mw6gA== X-Received: by 2002:a05:6808:3010:b0:343:f19:d58b with SMTP id ay16-20020a056808301000b003430f19d58bmr4002400oib.282.1663768283900; Wed, 21 Sep 2022 06:51:23 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:c266:dbbf:9e84:6582:5289]) by smtp.gmail.com with ESMTPSA id a38-20020a05687046a600b0010bf07976c9sm1669476oap.41.2022.09.21.06.51.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 06:51:23 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 4/6] rt: Initialize mq_send input on tst-mqueue{5,6} Date: Wed, 21 Sep 2022 10:51:06 -0300 Message-Id: <20220921135108.3324737-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> References: <20220921135108.3324737-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 Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" GCC with -Os warns that the mq_send input may be used uninitialized. Although for the tests the data content sent is not important, since both tests checks only if mq_notify was properly set, the warning is correct and data is indeed uninitialized. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- rt/tst-mqueue5.c | 2 +- rt/tst-mqueue6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c index 70d97a36c2..2b19b6a031 100644 --- a/rt/tst-mqueue5.c +++ b/rt/tst-mqueue5.c @@ -58,7 +58,7 @@ rtmin_handler (int sig, siginfo_t *info, void *ctx) static int (mqsend) (mqd_t q, int line) { - char c; + char c = 0; if (mq_send (q, &c, 1, 1) != 0) { printf ("mq_send on line %d failed with: %m\n", line); diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c index bc875f101e..a22ac05aca 100644 --- a/rt/tst-mqueue6.c +++ b/rt/tst-mqueue6.c @@ -40,7 +40,7 @@ static int (mqsend) (mqd_t q, int line) { - char c; + char c = 0; if (mq_send (q, &c, 1, 1) != 0) { printf ("mq_send on line %d failed with: %m\n", line); From patchwork Wed Sep 21 13:51:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 57848 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 E83CD3857362 for ; Wed, 21 Sep 2022 13:53:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E83CD3857362 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663768382; bh=20qWx9xGjOYDijsTmK59UPcgX2htVy0Z9x8Cm4cuKl0=; 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=OyHeL+QK/D1GxA/Mm7KmKC1asVfONBpiyZ3q3R3gwQjzz0QHm5HJSFQvoMqTfAn19 01l1rrdbFAsTXtFGAtUZLHm8TpxVLXZ41OTsNBaMA3UrfrTPEe2A1WpYm8f/efPA5g mVKplPgSOTVOBVN1BLql20Yk3jfpcmRO4Ofr3Rzg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by sourceware.org (Postfix) with ESMTPS id DA1483858028 for ; Wed, 21 Sep 2022 13:51:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DA1483858028 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-1278624b7c4so9125323fac.5 for ; Wed, 21 Sep 2022 06:51:25 -0700 (PDT) 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; bh=20qWx9xGjOYDijsTmK59UPcgX2htVy0Z9x8Cm4cuKl0=; b=t66l7Xey7HOtMuef0dF1kh2chIsYg5nkFE4vvXep9fnLkelQC0k3lkWKgZ/oS6wwLv BHqEgXftXcTjyUcu4l8z0DZG4rLEikUde7UxK0Z1AdAoMjIOLA1WXIAyUlP3YvRJOAmW GlgA1FW4yNS3LXYGYZAwVYN/lhiJlLqTB6qYEFRJXXnqVgeAygM4RyQpt6HH30166PtV iZcShxQve0rKQ/Y56igLhBoX65DSLRobFVHWq9GWEXxiIYbKj8JBz+STLdqIWWoljVTg qBI9c+D2DXUFUi94DOihOpDO3+zZzYT3FO/d37r321ZgCJFtwF+jzyJ0V5/ZLZXFaAB0 Nhwg== X-Gm-Message-State: ACrzQf0q0ihmRuQ9GInLMzJS5MoOqVG+iCz3KdSv+vGp2n1OZtXMaW9/ 2vSG+dEEd3fNg7ja8v2+VKyOWF360rn+WqLV X-Google-Smtp-Source: AMsMyM4FtXNyOeGpQDMy+eF4y4Jay1YyaGE4bjuq2KlcM2sbDhgoATYPN44Cu2qAIh1t/A5IbsE/XQ== X-Received: by 2002:a05:6870:b3a5:b0:127:9b3a:10e9 with SMTP id w37-20020a056870b3a500b001279b3a10e9mr5056305oap.203.1663768285003; Wed, 21 Sep 2022 06:51:25 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:c266:dbbf:9e84:6582:5289]) by smtp.gmail.com with ESMTPSA id a38-20020a05687046a600b0010bf07976c9sm1669476oap.41.2022.09.21.06.51.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 06:51:24 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 5/6] sunrpc: Suppress GCC -Os warning on user2netname Date: Wed, 21 Sep 2022 10:51:07 -0300 Message-Id: <20220921135108.3324737-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> References: <20220921135108.3324737-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 Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" GCC with -Os warns that sprint might overflow: netname.c: In function ‘user2netname’: netname.c:51:28: error: ‘%s’ directive writing up to 255 bytes into a region of size between 239 and 249 [-Werror=format-overflow=] 51 | sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom); | ^~ ~~~~~~~ netname.c:51:3: note: ‘sprintf’ output between 8 and 273 bytes into a destination of size 256 51 | sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors However the code does test prior the sprintf call that dfltdom plus the required extra space for OPSYS, uid, and extra character will not overflow and return 0 instead. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- sunrpc/netname.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sunrpc/netname.c b/sunrpc/netname.c index bf7f0b81c4..c1d1c43e50 100644 --- a/sunrpc/netname.c +++ b/sunrpc/netname.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "nsswitch.h" @@ -48,7 +49,12 @@ 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. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wformat-overflow"); sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom); + DIAG_POP_NEEDS_COMMENT; i = strlen (netname); if (netname[i - 1] == '.') netname[i - 1] = '\0'; From patchwork Wed Sep 21 13:51:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 57850 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 2CA6E3856DFE for ; Wed, 21 Sep 2022 13:53:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2CA6E3856DFE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663768428; bh=NS+5yEtxUeXWejx8bfHLU02mwR2MHWzSa/YDRPZRzko=; 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=JcDfnMwwD5IAfFdWs6nxzWMg4W0r0zjjOroM7OL+us5VptSHybblPbPenOSZWKZtT cLsIidxhGjuKwU1G8MPXVX/zlYV9aTKvJGsKi7pypJPo6a+PbaWPblO9kpMjuNlq/H wFJgbIkz6RnvrKlj030N0HojNNfasz3pctKpZkbc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id 06A4C3858406 for ; Wed, 21 Sep 2022 13:51:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 06A4C3858406 Received: by mail-oi1-x22a.google.com with SMTP id j188so8185576oih.0 for ; Wed, 21 Sep 2022 06:51:26 -0700 (PDT) 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; bh=NS+5yEtxUeXWejx8bfHLU02mwR2MHWzSa/YDRPZRzko=; b=rsKdyniF7JQmBawCjWusQR8J6dLQ7Hf4LhoT+8gScxsIjdA6vUSQqt/rBZKcsPAelX rOMXSgSFiOQrZq2ba9ZJVyfEoMp1bUarBygo/K+q8n4BPzSa+nW0KnWLF5JowOOpdX5X 3LmgmYZhkOMmdphnKeSwhdi+Hbn5Ft7mCGt1FR82AhXI3OW7gJxxyYzW7l/FtlMXB+Js 6ZKEG5pTTfriBujzZAsOW+JYuFh4u7LJTnNjBrVKOskNJcypQpCPoOuT0OcE5DGBxyXO ieFRba5djIhxMrsY4cyIT2+mw+OvyctRTKPeOXSJg8DRxzZNOD4a8eaPLN/FoctGstnU jNhA== X-Gm-Message-State: ACrzQf17aeE11GybDfhY6bodR5cA7rxNDHzlKtwYYYujr/K5I8phCup7 GbYeiCYTAkb7bJjaZBTKy4o6vBtGrxA4GBln X-Google-Smtp-Source: AMsMyM5i4Os3Iwm1UdokeQGUKRhM8xMO4GLueRbl0klQtn6mb4IMG3KWsbc3In5mFBpWC5vMaM6CKA== X-Received: by 2002:a05:6808:140e:b0:350:cdfb:8572 with SMTP id w14-20020a056808140e00b00350cdfb8572mr3868357oiv.9.1663768286092; Wed, 21 Sep 2022 06:51:26 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:c266:dbbf:9e84:6582:5289]) by smtp.gmail.com with ESMTPSA id a38-20020a05687046a600b0010bf07976c9sm1669476oap.41.2022.09.21.06.51.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 06:51:25 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 6/6] x86: Fix -Os build (BZ #29576) Date: Wed, 21 Sep 2022 10:51:08 -0300 Message-Id: <20220921135108.3324737-7-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> References: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The compiler might transform __stpcpy calls (which are routed to __builtin_stpcpy as an optimization) to strcpy and x86_64 strcpy multiarch implementation does not build any working symbol due ISA_SHOULD_BUILD not being evaluated for IS_IN(rtld). Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- sysdeps/x86_64/multiarch/rtld-strcpy.S | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sysdeps/x86_64/multiarch/rtld-strcpy.S diff --git a/sysdeps/x86_64/multiarch/rtld-strcpy.S b/sysdeps/x86_64/multiarch/rtld-strcpy.S new file mode 100644 index 0000000000..19439c553d --- /dev/null +++ b/sysdeps/x86_64/multiarch/rtld-strcpy.S @@ -0,0 +1,18 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "../strcpy.S"