aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2017-06-13 17:30:58 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2017-06-13 17:30:58 +0000
commit8a516588143f1b61b66b7ef6181e3b4a9a3077b4 (patch)
tree81afa16446d96529f082d5711253f86fc3ed1271
parent6ae036b33000414f273b9ad2a7ca7c1a668d0b31 (diff)
downloadgcc-8a516588143f1b61b66b7ef6181e3b4a9a3077b4.zip
gcc-8a516588143f1b61b66b7ef6181e3b4a9a3077b4.tar.gz
gcc-8a516588143f1b61b66b7ef6181e3b4a9a3077b4.tar.bz2
re PR objc/80949 (ICE in do_warn_duplicated_branches_r)
PR objc/80949 * c-warn.c (do_warn_duplicated_branches): Return if any of the branches is null. From-SVN: r249171
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-warn.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 8488768..9387bb0 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -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
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index 35321a6..056a058 100644
--- 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. */