https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104373
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- When not optimizing we intentionally warn about only conditionally executed cases early - and not optimizing means we do not detect trivially unreachable paths like this. I don't know whether we have good enough infrastructure now to have a way to determine that after discovering a possible uninit but it would be possible to fix this particular instance by walking BBs in RPO order and keeping a very simple const/copy lattice to avoid traversing along unreachable edges. The non-iterative VN algorithm does this for example. In theory you could also use that, you can specify eliminate == false so it doesn't modify the IL and if you then add a callback per reachable stmt (or BB) you'd get even more fancy cases handled (at compile-time cost of course). The other early diagnostic passes might also benefit from that. Alternatively you could just initialize EDGE_EXECUTABLE/BB_REACHABLE from it before the early diagnostic passes and then rely on that during those. Note it's all non-IPA though and the early diagnostic passes should maybe run from the local optimization pipeline, before early_inline (maybe after inlining always-inline though?), so they can benefit from local IPA analysis done on called functions.