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 1A93C3857809 for ; Wed, 5 Oct 2022 13:47:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1A93C3857809 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=1664977673; 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=CV1PZ3Hmrjzj4py36sqIU5bnlxotPfLar2qYuCQufBc=; b=ZLtUC4RK3mAOhEiNevfxjFvH/qSxBbXmBgvhxxJlrNAzNaSR18S+kdcR2bHc+fTlL+zMH1 rPgH4qJg1Q60L4wHumJT4Be6MsPOND+4HuQIGbQs7IlP/PNLrNtvPsXVfLbZ/q30Hxol9J 21aEPsyBYuLsgt1mGcPRpMtnm+lxThA= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-533-c2FJzKvQOtq0EvobEjXaZw-1; Wed, 05 Oct 2022 09:47:52 -0400 X-MC-Unique: c2FJzKvQOtq0EvobEjXaZw-1 Received: by mail-qt1-f199.google.com with SMTP id cb22-20020a05622a1f9600b0035bb51792d2so11222199qtb.5 for ; Wed, 05 Oct 2022 06:47:52 -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=CV1PZ3Hmrjzj4py36sqIU5bnlxotPfLar2qYuCQufBc=; b=zgtTMCVCNNQU7ckZDjxnvztfB+MVM696UjVAQLFZ6cf2ejwE8dT9NclMlko0/z7G8H GB7+GZGF8tOUDn6xLoqAohETzUDOiVg83tJufePFzEZIFCnDEuURWlG3pJ0seucBzJYX 98UnSSX30Vl1is/A0Q30cayjLK0YM5QqJh2Y9WuTSoDWCsXHLtK5GGvzr1jRFIx1eINR cxk7TM6Md8WRPOLlSh3ZLWoQRhYOj9dcinkR8Wd2uUHIrp2Ln5lTNvbW21m//oZWY1Ro WI7TyWF1iD0gFvP61VHZTxMdD1tNeIL9Zd6JKpoLVgSJnQhPIAt8MuoA4le+zhi/GEWI eO1Q== X-Gm-Message-State: ACrzQf2lbYM6iMD6EzkPnD/7RyERDabKg7NBFcUEydOLdyBlKBTr+jF7 kX4+zmM2C9qb7bBkhPaPW9uykgepvwlTxvnGo+FK+r9N9WU/HipfeXW7dL7qLyZjxsJ3eFvCtAS /AOGTIaKlkSGYdUKXEQX1 X-Received: by 2002:a05:620a:c10:b0:6e3:a2b5:2963 with SMTP id l16-20020a05620a0c1000b006e3a2b52963mr930499qki.582.1664977671740; Wed, 05 Oct 2022 06:47:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6p8QcxS//+5w6AkbjK74rojkXHNiZFWsqhq7dL4qDJCgFo8ay/vzq1PdeuDycja2pUTPJ+Qw== X-Received: by 2002:a05:620a:c10:b0:6e3:a2b5:2963 with SMTP id l16-20020a05620a0c1000b006e3a2b52963mr930486qki.582.1664977671472; Wed, 05 Oct 2022 06:47:51 -0700 (PDT) Received: from fedora ([66.187.232.65]) by smtp.gmail.com with ESMTPSA id u5-20020a05622a17c500b0035d0655b079sm13758398qtk.30.2022.10.05.06.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 06:47:50 -0700 (PDT) Date: Wed, 5 Oct 2022 09:47:48 -0400 From: Carlos O'Donell To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 2/6] posix: Suppress -Os warnings on fnmatch Message-ID: References: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> <20220921135108.3324737-3-adhemerval.zanella@linaro.org> MIME-Version: 1.0 In-Reply-To: <20220921135108.3324737-3-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.1 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:04AM -0300, Adhemerval Zanella via Libc-alpha wrote: > 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. LGTM. This touches gnulib code and may require merging upstream or harmonizing in a different way. For now this looks ok. There are some alternatives, but this is OK. 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; OK. > > /* 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; OK. > # 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; OK. > # 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; OK. > /* Adjust for the alignment. */ > idx = (idx + 3) & ~3; > cend = *((int32_t *) &extra[idx]); > -- > 2.34.1 >