From 314b419618daf524daca972f195bee1ba859a455 Mon Sep 17 00:00:00 2001 From: mpolacek Date: Tue, 13 Jun 2017 17:30:58 +0000 Subject: [PATCH] PR objc/80949 * c-warn.c (do_warn_duplicated_branches): Return if any of the branches is null. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249171 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-warn.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 84887683337..9387bb079c6 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2017-06-13 Marek Polacek + + PR objc/80949 + * c-warn.c (do_warn_duplicated_branches): Return if any of the + branches is null. + 2017-06-13 Martin Liska PR sanitize/78204 diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index 35321a6cb1b..056a058ca77 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. */ -- 2.11.4.GIT