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 3A0EF3858C83 for ; Mon, 28 Feb 2022 17:59:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A0EF3858C83 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-457-XUJC19P4Pk61VhRvpek82A-1; Mon, 28 Feb 2022 12:59:51 -0500 X-MC-Unique: XUJC19P4Pk61VhRvpek82A-1 Received: by mail-wm1-f69.google.com with SMTP id i131-20020a1c3b89000000b0037bb9f6feeeso6762395wma.5 for ; Mon, 28 Feb 2022 09:59:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=UZZls/SKo5XjMcSWIuhb5lNeo8s6SIJc4+e+TjV51oA=; b=T4CwvDAt992alcgmx+97t9E2XKfZNtfkP7HB5zQVPZ8ItNtcokLKc0aWnfpA9zqzlX aAMhbuR21JkOSjRCnhwi3gZfqLw2FazOyUQn+//kkYpDzHAv8I3LkwfAmn6ZZdar51OF xVEQQdaitgbM1ys7EwVZEnjQ/D1F43wEp+qhH/IRHzYcH4xqtuMb/BOktVQpLsCKbuuT ocFl9lOL0uT8f0ISUxJDYRqo0HnXI4Hn2T97EiHTsbVJ0SQogNq78DTtK29BWG8vT/yN L9S3ZoAr91ajLU1W+yOiV25DaHiU5ZybzUTjpfrwerEsEEnWkYe4Drn9jxJcsfauZLN+ ClVQ== X-Gm-Message-State: AOAM531MNXuREISxqYSeuWwVeUiKpX34UQsD86WX+MDy97rs5i7p4CeE 1PXwhArMFouTZLquEu82+fErjUpaRHeay9EEInXeNe2oqC/mMVEDcNpqpumTOcifxx7jd4pXk1Z CGq7XgdDUw3rXJeCY906rKw== X-Received: by 2002:a05:6000:18a1:b0:1ef:8e17:e82c with SMTP id b1-20020a05600018a100b001ef8e17e82cmr8411990wri.254.1646071190154; Mon, 28 Feb 2022 09:59:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJytiZ+4D5QXR0DKa2YovXgAPX9AsGISpPPghclGm6xgZD1lVPF6aFJ7gjA725MKYt6zmItCVA== X-Received: by 2002:a05:6000:18a1:b0:1ef:8e17:e82c with SMTP id b1-20020a05600018a100b001ef8e17e82cmr8411982wri.254.1646071189985; Mon, 28 Feb 2022 09:59:49 -0800 (PST) Received: from localhost (host86-169-131-29.range86-169.btcentralplus.com. [86.169.131.29]) by smtp.gmail.com with ESMTPSA id e18-20020adfdbd2000000b001e4bbbe5b92sm11814070wrj.76.2022.02.28.09.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 09:59:49 -0800 (PST) Date: Mon, 28 Feb 2022 17:59:48 +0000 From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [pushed] Fix maybe-uninitialized warning in py-infthread.c Message-ID: <20220228175948.GB1212730@redhat.com> References: <20220228175438.289669-1-tromey@adacore.com> MIME-Version: 1.0 In-Reply-To: <20220228175438.289669-1-tromey@adacore.com> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 17:59:35 up 1 day, 7:37, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.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, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Feb 2022 17:59:54 -0000 * Tom Tromey via Gdb-patches [2022-02-28 10:54= :38 -0700]: > I got this warning from py-infthread.c using the Fedora 34 system GCC: >=20 > ../../binutils-gdb/gdb/python/py-infthread.c:102:30: warning: =E2=80=98ex= tra_info=E2=80=99 may be used uninitialized in this function [-Wmaybe-unini= tialized] >=20 > I think this happens because GDB_PY_HANDLE_EXCEPTION expands to an > 'if' whose condition is always true -- but GCC can't know this. This > patch avoids the warning by adding a harmless initialization. Thanks for fixing this. Andrew > --- > gdb/python/py-infthread.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c > index 66c3efdf6cc..c94d5b0ddab 100644 > --- a/gdb/python/py-infthread.c > +++ b/gdb/python/py-infthread.c > @@ -87,7 +87,9 @@ thpy_get_details (PyObject *self, void *ignore) > =20 > THPY_REQUIRE_VALID (thread_obj); > =20 > - const char *extra_info; > + /* GCC can't tell that extra_info will always be assigned after the > + 'catch', so initialize it. */ > + const char *extra_info =3D nullptr; > try > { > extra_info =3D target_extra_thread_info (thread_obj->thread); > --=20 > 2.31.1 >=20