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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't think improving the threader (which is strictly an optimization, and
might not be beneficial/desirable in many cases, if it e.g. needs copying large
amounts of code) is the way to go here.  The tree-ssa-uninit.c code doesn't try
to solve this issue at all, it is about
  if (cond)
    v = something;
  some_code;
  if (cond)
    use (v);
where the 2 conditions might not be identical, but the latter needs to be a
subset of the former.  While in this case, it is:
  if (cond)
    v = something;
  some_code;
  if (!cond)
    v = something_else;
  use (v);
i.e. the use is unconditional, but the set is in the end also unconditional.

On the other side, we don't warn for:
int bar (int);

int
foo (int x)
{
  int a;
  if (x)
    a = bar (0);
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (1))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (2))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (3))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (4))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (5))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (6))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (7))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (8))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (9))))))))))));
  if (!x)
    a = bar (10);
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (11))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (12))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (13))))))))))));
  bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (14))))))))))));
  return a;
}

which simulates large amounts of code that should make the threader punt.

Reply via email to