Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
	asmwarrior <asmwarrior@gmail.com>,
	GDB Development <gdb@sourceware.org>
Subject: Re: gcc warning with "some variable may be used uninitialized in this function [-Wmaybe-uninitialized]" when building under msys
Date: Tue, 09 Oct 2018 20:01:00 -0000	[thread overview]
Message-ID: <6b1f8652-a44f-a4d1-6497-3d9a1cfdc3cf@redhat.com> (raw)
In-Reply-To: <52ef21f6-8129-2f0e-9510-8e6545d2f2e8@redhat.com>

On 10/09/2018 08:54 PM, Pedro Alves wrote:
> On 10/09/2018 08:33 PM, Tom Tromey wrote:
>>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> 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<T>.

Maybe we could make gdb::optional's ctor initialize the payload
only in devel mode, leave it uninitialized in release mode,
and add back -Werror for that warning.  We'd see the warnings in
release mode, but releases don't use -Werror so it's less of
an issue.

Doesn't really fix the issue though, just papers over it.
Not sure that really helps.

Thanks,
Pedro Alves


  reply	other threads:[~2018-10-09 20:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04  6:28 asmwarrior
2018-10-04 12:01 ` Simon Marchi
2018-10-04 12:40   ` Pedro Alves
2018-10-05  5:08     ` Tom Tromey
2018-10-09 10:34       ` Pedro Alves
2018-10-09 19:34         ` Tom Tromey
2018-10-09 19:54           ` Pedro Alves
2018-10-09 20:01             ` Pedro Alves [this message]
2018-10-09 20:04             ` Tom Tromey
2018-10-04 12:41   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b1f8652-a44f-a4d1-6497-3d9a1cfdc3cf@redhat.com \
    --to=palves@redhat.com \
    --cc=asmwarrior@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox