From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x335.google.com with SMTP id x23-20020a056830409700b00655c6dace73so3960062ott.11 for ; Wed, 21 Sep 2022 06:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=mzgatIN4FW972MjjKNR65A0ixgYtxq0aUlH24MTvBss=; b=Ig7IBNYBpb5xHRudlc61jlZg9jNQPul/fjhhaYsLc1LSduRMoHpiJ1tLtCDHzCvspa C2YKJ9ZCX9NZJ2jawRSn0agMTnK6zBo2c7GlmsQPBwCq0TzxUbdKiAc+2QsdAkyuEUPz 8iPpLMorUPTiBgrgNYGV7lpsNtJb0gfoce6CSJLAqbIpbRwUHSwkFVAhZr577I4RxTJr Cz4LbjJq7C4d2oiyN67IniHVN7r2qD45FJLOy5/oNLdXja7m4Mx3x67PoPTaao8phB+C ss61xxzazE6Uc8V2fpElXYNDimnAFtHQdQjGPM1HU+1AgF6TiG3miVHlWXxk7cZWkyO7 jggQ== 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) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Martin Jansa 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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; | ^~~~ --- 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; -- 2.34.1