https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2022-08-19 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- The predicate analysis has difficulties in handling this case, its like void foo (int val) { int uninit; for (;;) { if (..) { .. = val; (*) val = uninit; } # val = PHI <..> } } and we diagnose (*), figuring the loop PHI of 'val' eventually leads to the PHI that post-dominates the use we want to diagnose. One issue with this is that the predicates provided are from a different iteration than those used so we won't have a chance to compare things meanigfully here. I think the best thing is to avoid diagnosing possibly uninitialized uses in the next iteration of a loop because we have no chance to prove the path is unreachable and thus we'll always warn. At least I think so. I do have a patch.