https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97125

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think we just want to call do_warn_duplicated_branches_r after we've lowered
control statements:

--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -533,10 +533,6 @@ c_genericize (tree fndecl)
         &pset);
     }

-  if (warn_duplicated_branches)
-    walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
-                 do_warn_duplicated_branches_r, NULL);
-
   /* Genericize loops and other structured control constructs.  The C++
      front end has already done this in lang-specific code.  */
   if (!c_dialect_cxx ())
@@ -550,6 +546,10 @@ c_genericize (tree fndecl)
       pop_cfun ();
     }

+  if (warn_duplicated_branches)
+    walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
+                 do_warn_duplicated_branches_r, NULL);
+
   /* Dump the C-specific tree IR.  */
   dump_orig = get_dump_info (TDI_original, &local_dump_flags);
   if (dump_orig)

Reply via email to