https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80949
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Would it be possible for you to try this patch? --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -2354,8 +2354,8 @@ do_warn_duplicated_branches (tree expr) tree thenb = COND_EXPR_THEN (expr); tree elseb = COND_EXPR_ELSE (expr); - /* Don't bother if there's no else branch. */ - if (elseb == NULL_TREE) + /* Don't bother if any of the branches is missing. */ + if (thenb == NULL_TREE || elseb == NULL_TREE) return; /* And don't warn for empty statements. */