public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "qinzhao at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/102276] -ftrivial-auto-var-init fails to initialize a variable, causes a spurious warning
Date: Thu, 17 Feb 2022 19:57:08 +0000	[thread overview]
Message-ID: <bug-102276-4-kbdcJXEFhB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102276-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102276

--- Comment #14 from qinzhao at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #7)

> and so for flag_auto_var_init > AUTO_INIT_UNINITIALIZED perhaps we could also
> avoid warnings on:
> 1) call to .DEFERRED_INIT
> 2) call to __builtin_clear_padding if the second argument is present and
> non-zero
> 3) I guess we would need not to warn on a gimple assign store right after
> the .DEFERRED_INIT call that has the lhs of .DEFERRED_INIT as rhs
> anything else?

After more study of the source code for maybe_warn_switch_unreachable, I
realize that in order to emit the switch_unreachable warning,
"warn_switch_unreachable_r" first is called to scan the switch sequence and
saved the FIRST "REAL" gimple stmt.  then it will check this FIRST "REAL" stmt
to see whether it's the LABEL, if it's not, then report the switch unreachable
warning. 

So, we only need to consider the FIRST "REAL" gimple for the above 3 cases. For
all the 3 cases, the FIRST "REAL" gimple is a call to .DEFERRED_INIT. 
So, inside maybe_warn_switch_unreachable, we only need to check whether the
FIRST gimple is a cal .DEFERRED_INIT, that's enough.

  parent reply	other threads:[~2022-02-17 19:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 14:17 [Bug middle-end/102276] New: " amonakov at gcc dot gnu.org
2021-09-13 10:14 ` [Bug middle-end/102276] " rguenth at gcc dot gnu.org
2021-09-13 17:50 ` amonakov at gcc dot gnu.org
2021-09-14 17:55 ` kees at outflux dot net
2022-02-12 18:14 ` kees at outflux dot net
2022-02-12 20:22 ` pinskia at gcc dot gnu.org
2022-02-14  7:26 ` rguenth at gcc dot gnu.org
2022-02-14 16:08 ` jakub at gcc dot gnu.org
2022-02-14 17:02 ` qinzhao at gcc dot gnu.org
2022-02-14 23:21 ` qinzhao at gcc dot gnu.org
2022-02-15  8:16 ` rguenther at suse dot de
2022-02-15 16:02 ` qinzhao at gcc dot gnu.org
2022-02-15 19:55 ` qinzhao at gcc dot gnu.org
2022-02-17  7:22 ` rguenther at suse dot de
2022-02-17 19:57 ` qinzhao at gcc dot gnu.org [this message]
2022-03-02 16:55 ` cvs-commit at gcc dot gnu.org
2022-03-02 16:56 ` qinzhao at gcc dot gnu.org

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=bug-102276-4-kbdcJXEFhB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).