This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug objc/80949] ICE in do_warn_duplicated_branches_r


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.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]