From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id CC36F3858C54 for ; Wed, 5 Oct 2022 13:39:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC36F3858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664977168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H82dgKMjOo+acuLON7JeGfLxWijyPz0O8yqa5AfsMw4=; b=BAT6waHSfHpZ4wrjKpNZ5R/pw30Q3vMOlFzAzmywz3pA/hCdE/Z8hi73LzDw00p9SRd8uv OjFiJEZRJv36d7ha6yCw9cUq6KhaCGZ49SZIXBT85Qkn2TrbC+BzbL/CiIWgBk8wlXMtN+ +v2eK4pR823xuO3JrBtiYuhdY6ZiuLM= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-251-8R9i8fLkP-asGHZ4T33pGw-1; Wed, 05 Oct 2022 09:39:27 -0400 X-MC-Unique: 8R9i8fLkP-asGHZ4T33pGw-1 Received: by mail-qk1-f198.google.com with SMTP id u6-20020a05620a430600b006e47fa02576so41146qko.22 for ; Wed, 05 Oct 2022 06:39:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=H82dgKMjOo+acuLON7JeGfLxWijyPz0O8yqa5AfsMw4=; b=qk9Usm70bgov8kw1S1Cb3zlVs5Nga5TRagDnNU59/Py741Q2H1Z9Obw9+ef12O2kZq W3aZxdxIpkkFvJfnIHao/eSVIiU6Ce0favQDcJe46XH1TAD1RqsIZcRd0P2zhXzPFkFP FNVG4M1bRD41+Qd2+mx00wZ64ck6h+JVvXU3c1Hj8abAzPBPE8NZ5NyVhNtuhYACzMnx d+e43sxjCiVb13fgjjIefsqS0IiarC4NYHO93dKl1QULpnS+R5yOXVJf88xhOcaUFdG7 e76FKd1eeZO682LyGZuqWtOgg5MUMxrowPkcn/ah75IBWdHKgeaB6DuQ7xJffWg7w3ut prUg== X-Gm-Message-State: ACrzQf0rQuwSKIC6z8+HMjWrMUoFTbo0Da7XskSkIxA4Bi42IX8BLC3O uvVIkHg8kvAHhHfkEoK0Qs7tMh2JAnww34q+V/HGvxh7H4dQSAdvEtXKUjB/oOXz3dVZOfO5jU+ WTTLYAJDvEWUVOcJn7c6x X-Received: by 2002:ac8:5b89:0:b0:35d:42d1:1634 with SMTP id a9-20020ac85b89000000b0035d42d11634mr22891801qta.285.1664977166677; Wed, 05 Oct 2022 06:39:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50lRRz3vS3aJYmu/t387YQTHYdWbsbwuJuoIIV073sjVwZ/tzrfmFvxlnvmkMw+5aX/2J6nw== X-Received: by 2002:ac8:5b89:0:b0:35d:42d1:1634 with SMTP id a9-20020ac85b89000000b0035d42d11634mr22891788qta.285.1664977166456; Wed, 05 Oct 2022 06:39:26 -0700 (PDT) Received: from fedora ([66.187.232.65]) by smtp.gmail.com with ESMTPSA id u4-20020a37ab04000000b006e26c6db902sm1946992qke.53.2022.10.05.06.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 06:39:25 -0700 (PDT) Date: Wed, 5 Oct 2022 09:39:23 -0400 From: Carlos O'Donell To: Adhemerval Zanella Cc: libc-alpha@sourceware.org, Martin Jansa Subject: Re: [PATCH 1/6] locale: prevent maybe-uninitialized errors with -Os [BZ #19444] Message-ID: References: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> <20220921135108.3324737-2-adhemerval.zanella@linaro.org> MIME-Version: 1.0 In-Reply-To: <20220921135108.3324737-2-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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: On Wed, Sep 21, 2022 at 10:51:03AM -0300, Adhemerval Zanella via Libc-alpha wrote: > 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; > | ^~~~ LGTM. No regresions on x86_64. 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. */ OK. Agreed. > + 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 >