https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96245
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- Only (1) would be true. Like the optimization, the warning wouldn't trigger in code that didn't follow the pattern because there's no way to tell if that's deliberate or a bug. I'd expect the warning to be useful by discouraging a questionable pattern. I don't suppose this comes up a lot so like the optimization, the difference the warning would make in practice can be debated. Unlike the optimization alone, though, it would lead to less repetitive and so more readable code.