From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EAD2D3857C61; Sun, 20 Sep 2020 20:32:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAD2D3857C61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600633933; bh=ut1k/M1vtf+dDKh1Y7qzQSAJj9o31suBvBiBI8vp7hs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X5qPfz4+Ogz1ZaDoNhRSZNHYR0yrqb4EFDb8np8c5umNbgu/886cLnNz7ONA2b/dm uve4GOBIgQ3bWcl+8gJxJf6eM3ORLyzJxNf+2PrfGI4FHJNRmy+xKGZL43Ir4YzKxd nH+Cpp3ZdJ9cq+SthDT1owyrwsqtGPXFIGp8AwfM= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/97125] [11 Regression] new problem with -Wduplicated-branches Date: Sun, 20 Sep 2020 20:32:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Sep 2020 20:32:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97125 --- Comment #5 from Marek Polacek --- I think we just want to call do_warn_duplicated_branches_r after we've lowe= red 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 =3D get_dump_info (TDI_original, &local_dump_flags); if (dump_orig)=