https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114763
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- -Wduplicate-branches compares the substatements of an if statement. In C/C++, there is not a statement like if ... elseif ... elseif ... else, just if statement. In your first example, there are 2 if statements, one has { x -= 2; } and if (x > 50) { x -= 2; } else x += 2; substatements (and those are not the same), and the other has { x -= 2; } and x += 2; substatements and those aren't the same either.