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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
           Priority|P3                          |P2

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  I don't know how the dataflow of the diagnostic is implemented but
to fix this it would need to go backwards from function exits and maintain a
set of "killed" locations it would not diagnose in earlier code.  Of course
it's difficult in general considering

  global = &local;
  tem = global;
  other_global = tem;
  global = NULL;

and here &local escapes to other_global but we'd have to either rely on
optimization forwarding &local to tem or we'd have to conservatively
assume escaping (what the current code seems to do).  The former gets
you false negatives while the latter false positives.

Note for the testcase the store we diagnose is not dead since it has
possible uses via function calls also getting 'this', so optimization
is of no help in avoiding the false positive here.

Reply via email to