From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>,
asmwarrior <asmwarrior@gmail.com>
Cc: 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: Thu, 04 Oct 2018 12:40:00 -0000 [thread overview]
Message-ID: <8305e255-1621-96a7-cf06-3cd1cd27ceae@redhat.com> (raw)
In-Reply-To: <9aa0ec3d6356d1e0c746697161918576@polymtl.ca>
On 10/04/2018 01:00 PM, Simon Marchi wrote:
> On 2018-10-04 02:28, asmwarrior wrote:
>> Hi, when building gdb git head(which is
>> 875e539851bb2702f3292f819e220545a8776242 as 2018-10-04) under msys+gcc
>> 5.4, I see such warning:
>>
>> Â CXXÂ Â Â infrun.o
>> In file included from ../../binutils-gdb/gdb/inferior.h:49:0,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â from ../../binutils-gdb/gdb/infrun.c:26:
>> ../../binutils-gdb/gdb/progspace.h: In function 'void
>> handle_vfork_child_exec_or_exit(int)':
>> ../../binutils-gdb/gdb/progspace.h:285:47: warning: '*((void*)(&
>> maybe_restore_inferior)+16).scoped_restore_current_program_space::m_saved_pspace'
>> may be used uninitialized in this function [-Wmaybe-uninitialized]
>> Â Â { set_current_program_space (m_saved_pspace); }
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
>> ../../binutils-gdb/gdb/infrun.c:931:6: note: '*((void*)(&
>> maybe_restore_inferior)+16).scoped_restore_current_program_space::m_saved_pspace'
>> was declared here
>> Â Â Â Â Â maybe_restore_inferior;
>> Â Â Â Â Â ^
>> Â CXXÂ Â Â inline-frame.o
>>
>> Hope you devs can fix this. Thanks.
>>
>> Asmwarrior
>
> I also see this from time to time. I think it is a false positive, but I may be wrong. Do you see a code path that could actually be problematic?
That warning is documented as producing false positives.
And those preexisting warnings are hard/ugly to disable
with #pragma GCC diagnostic push/pop.
That's why we disable -Werror for that warning.
There's been mild talking about moving -Wmaybe-uninitialized out
of -Wall in gcc, which I think would make sense. Over time,
GCC's VRP etc. technology will improve and those same bugs
will be warned by -Wuninitialized instead (I'd hope).
See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
If the warnings confuse people too much, I'd be OK with
disabling -Wmaybe-uninitlized completely. I left it as a
-Wno-error warning because even though it produces false positives,
it also helps catch bugs earlier in the compile-edit cycle,
when you're hacking some code, when you're introducing
uninitialized uses, and "make" ends up compiling just a few
files.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2018-10-04 12:40 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 [this message]
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
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=8305e255-1621-96a7-cf06-3cd1cd27ceae@redhat.com \
--to=palves@redhat.com \
--cc=asmwarrior@gmail.com \
--cc=gdb@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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