re PR objc/80949 (ICE in do_warn_duplicated_branches_r)
authorMarek Polacek <polacek@redhat.com>
Tue, 13 Jun 2017 17:30:58 +0000 (17:30 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 13 Jun 2017 17:30:58 +0000 (17:30 +0000)
PR objc/80949
* c-warn.c (do_warn_duplicated_branches): Return if any of the
branches is null.

From-SVN: r249171

gcc/c-family/ChangeLog
gcc/c-family/c-warn.c

index 84887683337d72a4e3ae811e754817e76b48de4b..9387bb079c6e27ab1f9969f8d2f51c980a348341 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-13  Marek Polacek  <polacek@redhat.com>
+
+       PR objc/80949
+       * c-warn.c (do_warn_duplicated_branches): Return if any of the
+       branches is null.
+
 2017-06-13  Martin Liska  <mliska@suse.cz>
 
        PR sanitize/78204
index 35321a6cb1b10136e3cf4399a2a27b132d92239f..056a058ca7719435d7dcff0d3f5f57ef040b085c 100644 (file)
@@ -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.  */