public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/96295] [11 Regression] -Wmaybe-uninitialized warning for range operator with reference to an empty struct Date: Thu, 23 Jul 2020 15:08:15 +0000 [thread overview] Message-ID: <bug-96295-4-4L0Z1bi0bE@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-96295-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96295 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |11.0 Summary|Wmaybe-uninitialized |[11 Regression] |warning for range operator |-Wmaybe-uninitialized |with empty range struct |warning for range operator | |with reference to an empty | |struct Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Last reconfirmed| |2020-07-23 CC| |msebor at gcc dot gnu.org --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. The warning detects and avoids triggering for objects of empty types but in the test case __for_range is a reference to such an object and the logic doesn't consider those. The tweak below makes the warning go away. Let me handle this. diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c index 2f0ff724cde..fa88cad841c 100644 --- a/gcc/tree-ssa-uninit.c +++ b/gcc/tree-ssa-uninit.c @@ -401,6 +401,8 @@ maybe_warn_operand (ao_ref &ref, gimple *stmt, tree lhs, tree rhs, The first_field() test is important for C++ where the predicate alone isn't always sufficient. */ tree rhstype = TREE_TYPE (rhs); + if (POINTER_TYPE_P (rhstype)) + rhstype = TREE_TYPE (rhstype); if (TYPE_EMPTY_P (rhstype) || (RECORD_OR_UNION_TYPE_P (rhstype) && (!first_field (rhstype)
next prev parent reply other threads:[~2020-07-23 15:08 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-23 7:56 [Bug tree-optimization/96295] New: Wmaybe-uninitialized warning for range operator with empty range struct vries at gcc dot gnu.org 2020-07-23 15:08 ` msebor at gcc dot gnu.org [this message] 2020-09-15 19:01 ` [Bug tree-optimization/96295] [11 Regression] -Wmaybe-uninitialized warning for range operator with reference to an empty struct msebor at gcc dot gnu.org 2020-09-16 19:24 ` cvs-commit at gcc dot gnu.org 2020-09-16 19:25 ` msebor at gcc dot gnu.org 2020-09-17 16:24 ` msebor 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-96295-4-4L0Z1bi0bE@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: linkBe 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).