This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/61112] Simple example triggers false-positive -Wmaybe-uninitialized warning


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]