This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug objc/80949] ICE in do_warn_duplicated_branches_r
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 13 Jun 2017 10:47:41 +0000
- Subject: [Bug objc/80949] ICE in do_warn_duplicated_branches_r
- Auto-submitted: auto-generated
- References: <bug-80949-4@http.gcc.gnu.org/bugzilla/>
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. */