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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |amacleod at redhat dot com,
                   |                            |law at gcc dot gnu.org

--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
I think we should start thinking of any Wuninitialized warnings in terms of
missed threads, at least initially.  Jeff has mentioned this in the past, an
I'm slowly being converted.  I mean, not that there aren't problems in the
uninit code, but we should at least check that there are no missing threads.

The problematic read from x is in BB5:

  <bb 5> [local count: 55807731]:
  h (x_17, y_2);
  y_16 = g ();
  goto <bb 7>; [100.00%]

On paths starting on 2->3 x_17 is defined, whereas on paths starting on 2->6
x_17 is undefined:

  <bb 6> [local count: 59055799]:
  # x_17 = PHI <x_10(3), x_6(D)(2)>

Looking at the last threader (threadfull2) before the uninit pass we see boths
paths are registered for threading:

  [3] Registering jump thread: (3, 6) incoming edge;  (6, 7) normal (7, 8)
normal (8, 4) normal (4, 5) nocopy; 

  [4] Registering jump thread: (2, 6) incoming edge;  (6, 7) normal (7, 8)
normal (8, 4) normal (4, 10) nocopy; 

However, there were no threaded paths in the entire compilation:

$ grep thread a.c.338t.statistics 
$

So sometime between registering the path for threading and the lowlevel BB
copier, we dropped the threads.

The culprit is duplicate_thread_path in the generic bits:

      /* We do not handle subloops, i.e. all the blocks must belong to the
         same loop.  */
      if (region[i]->loop_father != loop)
        return false;

This is an area I'm unfamiliar with, but it seems we should be able to thread
this when loop optimizations are done.

And indeed, if we allow this when loop_done, no warning is emitted.

Reply via email to