From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68178 invoked by alias); 9 Oct 2018 19:54:56 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 68157 invoked by uid 89); 9 Oct 2018 19:54:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Oct 2018 19:54:55 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B100188E50; Tue, 9 Oct 2018 19:54:48 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id A369719484; Tue, 9 Oct 2018 19:54:47 +0000 (UTC) Subject: Re: gcc warning with "some variable may be used uninitialized in this function [-Wmaybe-uninitialized]" when building under msys To: Tom Tromey References: <46b498a8-ba44-3f67-783d-85cd5ac8f0c9@gmail.com> <9aa0ec3d6356d1e0c746697161918576@polymtl.ca> <8305e255-1621-96a7-cf06-3cd1cd27ceae@redhat.com> <87d0spf0au.fsf@tromey.com> <878t36gbix.fsf@tromey.com> Cc: Simon Marchi , asmwarrior , GDB Development From: Pedro Alves Message-ID: <52ef21f6-8129-2f0e-9510-8e6545d2f2e8@redhat.com> Date: Tue, 09 Oct 2018 19:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <878t36gbix.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-10/txt/msg00013.txt.bz2 On 10/09/2018 08:33 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > >>> It would be good if gcc could recognize std::optional and not issue the >>> warning when it is used. Perhaps gdb could then just always use >>> optional for the maybe-not-initialized cases. > > Pedro> Really not sure whether that is possible. I think there's hope > Pedro> that GCC value tracking becomes smart enough that these > Pedro> std::optional-related warnings end up disappearing (which usually > Pedro> means the code will optimize better too). Fingers crossed, at least. > > For gdb::optional, I think it would be good enough if we could simply > suppress the warning and make operator* assert that the object was > instantiated. Perhaps std::optional could enforce this in debug mode as > well. Last I tried, I couldn't find a way to suppress the warning from gdb::optional. The warning triggers in code that belongs to T in gdb::optional. Thanks, Pedro Alves