https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103483
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |WONTFIX Status|NEW |RESOLVED --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- I don't think this can be "fixed." Most middle end warnings work a single statement at a time and depend on optimization like constant propagation and dead code elimination to do their job. If one optimization exposes an invalid statement that would otherwise be eliminated by another optimization that doesn't take place, the warnings trigger. That's all by design and there's no way change that. In the test case in comment #0 where the precondition is that d be less than a, making it explicit (e.g., either as Andrew suggests in comment #1 or by adding an equivalen assert statement) seems like the best and only solution.