public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "patrick at parcs dot ath.cx" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/61112] Simple example triggers false-positive -Wmaybe-uninitialized warning
Date: Thu, 08 May 2014 16:27:00 -0000	[thread overview]
Message-ID: <bug-61112-4-sRwoIDiAuZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61112-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61112

--- Comment #2 from patrick at parcs dot ath.cx ---
Relevant contents of -fdump-tree-uninit:

[WORKLIST]: Update worklist with phi: w_2 = PHI <w_1(5), 10(10)>
[CHECK]: examining phi: w_2 = PHI <w_1(5), 10(10)>

[CHECK] Found def edge 1 in w_1 = PHI <w_5(D)(3), z_6(D)(9)>

[CHECK] Found def edge 1 in w_2 = PHI <w_1(5), 10(10)>

[AFTER NORMALIZATION -- [USE]:
p = w_2;
is guarded by :

y_7(D) != 0
(.OR.)
x_4(D) != 0

[AFTER NORMALIZATION -- [DEF]:
w_2 = PHI <w_1(5), 10(10)>
is guarded by :

y_7(D) != 0


[CHECK]: Found unguarded use: p = w_2;

void
void foo(int, int, int) (int x, int y, int z)
{
  int w;
  int _8;

  <bb 2>:
  if (x_4(D) != 0)
    goto <bb 9>;
  else
    goto <bb 3>;

  <bb 9>:
  goto <bb 4>;

  <bb 3>:

  <bb 4>:
  # w_1 = PHI <w_5(D)(3), z_6(D)(9)>
  if (y_7(D) != 0)
    goto <bb 10>;
  else
    goto <bb 5>;

  <bb 10>:
  goto <bb 6>;

  <bb 5>:

  <bb 6>:
  # w_2 = PHI <w_1(5), 10(10)>
  _8 = x_4(D) | y_7(D);
  if (_8 != 0)
    goto <bb 7>;
  else
    goto <bb 11>;

  <bb 11>:
  goto <bb 8>;

  <bb 7>:
  p = w_2;

  <bb 8>:
  return;

}


uninit analysis correctly detects two defining edges but one of the edges
(src=bb 9, dest=bb 4) flows into the control dependence root (bb 6).  Since
this edge can not be reached downwards from the CD root, it is not considered
when reconstructing the predicate chain that guards the definition of w_2.  As
a result, an incomplete def predicate chain is computed and a warning is
emitted.

If instead the control dependence root was bb 2 then the aforementioned edge
would not get discarded (because the edge could be reached from bb 2) and so
the computed def predicate chain would be complete.

I have a patch that fixes this issue.


  parent reply	other threads:[~2014-05-08 16:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 14:07 [Bug middle-end/61112] New: " patrick at parcs dot ath.cx
2014-05-08 14:08 ` [Bug middle-end/61112] " patrick at parcs dot ath.cx
2014-05-08 16:27 ` patrick at parcs dot ath.cx [this message]
2021-03-29 19:54 ` cvs-commit at gcc dot gnu.org
2021-03-29 20:03 ` msebor at gcc dot gnu.org
2021-03-30 16:42 ` manu at gcc dot gnu.org
2021-11-30 14:44 ` aldyh 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-61112-4-sRwoIDiAuZ@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).