From: Krishna Narayanan <krishnanarayanan132002@gmail.com>
To: Martin Sebor <msebor@gmail.com>, gcc-help <gcc-help@gcc.gnu.org>,
Jonathan Wakely <jwakely.gcc@gmail.com>
Subject: Re: Extended doubt regarding the bug 93432
Date: Wed, 9 Feb 2022 10:36:21 +0530 [thread overview]
Message-ID: <CABhGnjtog8mU_w2D4d0dR=tG4FAnZ_qPT_VUBBEOyQpsF5wAeg@mail.gmail.com> (raw)
In-Reply-To: <641d2125-7809-77eb-f007-3dd784940873@gmail.com>
Yes Sir,
I will go through the dump from uninit pass with required optimizations.I
will try the tree-ssa-uninit.cc on gdb.
Thanks and Regards,
Krishna Narayanan.
On Wed, Feb 9, 2022 at 3:20 AM Martin Sebor <msebor@gmail.com> wrote:
> On 2/8/22 10:37, Jonathan Wakely via Gcc-help wrote:
> > On Tue, 8 Feb 2022 at 17:18, Krishna Narayanan <
> > krishnanarayanan132002@gmail.com> wrote:
> >
> >> Thanks for your response,Could you please clarify if this is a bug?
> >>
> >
> > It warns with -O1, which is the documented behaviour:
> >
> > The effectiveness of some warnings depends on optimizations also
> > being enabled. For example -Wsuggest-final-types is more
> > effective with link-time optimization and -Wmaybe-uninitialized
> does
> > not warn at all unless optimization is enabled.
>
> Yes, although the latter sentence is no longer completely accurate.
> Since GCC 11 -Wmaybe-uninitialized doesn't need optimization to trigger
> for code that passes an uninitialized object to a function that takes
> a const reference. Let me update the manual with that.
>
> > So no, I don't think it' a bug. GCC is behaving as designed. Ideally it
> > would be better at warning without optimization, but changing that would
> be
> > hard.
>
> It might be tricky to handle this case without causing false positives
> in others.
>
> Krishna, to understand why some of these cases are diagnosed and others
> aren't, you need to look at either the dump from the uninit pass
> (-fdump-tree-uninit) with -O1 and above, or at some early dump (e.g.,
> -fdump-tree-ssa) at -O0. Here's a link to the former on Godbolt for
> your example:
>
> https://gcc.godbolt.org/z/89c4s7o6E
>
> The best way is of course to step through GCC in a debugger (for
> the uninitialized warnings the code is in gcc/tree-ssa-uninit.cc).
>
> Martin
>
> >
> >
> >
> >
> >
> >> Regards,
> >> Krishna Narayanan.
> >>
> >> On Tue, Feb 8, 2022 at 10:28 PM Jonathan Wakely <jwakely.gcc@gmail.com>
> >> wrote:
> >>
> >>>
> >>>
> >>> On Tue, 8 Feb 2022 at 16:25, Krishna Narayanan via Gcc-help <
> >>> gcc-help@gcc.gnu.org> wrote:
> >>>
> >>>> Hello,
> >>>> As an extension to the bug 93432
> >>>> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93432), I would like to
> >>>> add a few more points,here in the given code
> >>>> (https://godbolt.org/z/sYjqjqh3d) there is a warning averted but
> there
> >>>> is no warning shown for this code
> >>>> (https://gcc.godbolt.org/z/oo5sf4oec) .
> >>>> I tried it with "-fno-strict-aliasing -fwrapv
> >>>> -fno-aggressive-loop-optimizations" and "fsanitize=undefined".There
> >>>> are no errors for gcc but clang has runtime errors,the error for
> >>>> clang: https://gcc.godbolt.org/z/1hq8x1o8E .
> >>>>
> >>>> Can we have a warning in the second case as well? It will be much more
> >>>> convenient as there is a lapse of initialization.
> >>>>
> >>>
> >>> Yes, ideally it would warn.
> >>>
> >>>
> >>>
> >>
>
>
next prev parent reply other threads:[~2022-02-09 5:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 16:24 Krishna Narayanan
2022-02-08 16:58 ` Jonathan Wakely
2022-02-08 17:17 ` Krishna Narayanan
2022-02-08 17:37 ` Jonathan Wakely
2022-02-08 17:47 ` Krishna Narayanan
2022-02-08 21:50 ` Martin Sebor
2022-02-09 5:06 ` Krishna Narayanan [this message]
2022-02-11 18:10 ` Krishna Narayanan
2022-02-14 15:24 ` Martin Sebor
[not found] ` <CABhGnjvSO8svWrBNiO3aKJDjZ5mx2pE-kKgH-0pmyBYjLTwBRw@mail.gmail.com>
2022-02-14 20:22 ` Martin Sebor
2022-02-15 12:10 ` Krishna Narayanan
2022-02-16 21:27 ` Martin Sebor
2022-02-19 13:38 ` Krishna Narayanan
2022-02-09 16:59 ` Segher Boessenkool
2022-02-09 18:43 ` Krishna Narayanan
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='CABhGnjtog8mU_w2D4d0dR=tG4FAnZ_qPT_VUBBEOyQpsF5wAeg@mail.gmail.com' \
--to=krishnanarayanan132002@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=jwakely.gcc@gmail.com \
--cc=msebor@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).