From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 3F6D6385780A; Tue, 30 Nov 2021 13:25:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3F6D6385780A Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 2F6AF1FD58; Tue, 30 Nov 2021 13:25:42 +0000 (UTC) Received: from murzim.suse.de (murzim.suse.de [10.160.4.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0FF3AA3B95; Tue, 30 Nov 2021 13:25:42 +0000 (UTC) Date: Tue, 30 Nov 2021 14:25:41 +0100 (CET) From: Richard Biener To: Mikael Morin cc: gcc-patches@gcc.gnu.org, gfortran Subject: Re: [PATCH] Avoid some -Wunreachable-code-ctrl In-Reply-To: Message-ID: <83n991n3-7n59-8288-9nop-qqo08qqop359@fhfr.qr> References: MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Nov 2021 13:25:45 -0000 On Tue, 30 Nov 2021, Mikael Morin wrote: > Le 29/11/2021 à 16:03, Richard Biener via Gcc-patches a écrit : > > diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c > > index f5ba7cecd54..16ee2afc9c0 100644 > > --- a/gcc/fortran/frontend-passes.c > > +++ b/gcc/fortran/frontend-passes.c > > @@ -5229,7 +5229,6 @@ gfc_expr_walker (gfc_expr **e, walk_expr_fn_t exprfn, > > void *data) > > case EXPR_OP: > > WALK_SUBEXPR ((*e)->value.op.op1); > > WALK_SUBEXPR_TAIL ((*e)->value.op.op2); > > - break; > > case EXPR_FUNCTION: > > for (a = (*e)->value.function.actual; a; a = a->next) > > WALK_SUBEXPR (a->expr); > > I’m uncomfortable with the above change. > It makes it look like there is a fall through, but there is not. > Maybe inline the macro to make the continue explicit, or use WALK_SUBEXPR > instead of WALK_SUBEXPR_TAIL and hope the compiler will do the tail call > optimization. Ah, it follows the style in tree.c:walk_tree_1 where break was used inconsistently after WALK_SUBTREE_TAIL which was then more obvious to me to clean up. I didn't realize the fortran FE only had a single WALK_SUBEXPR_TAIL. I'm not sure inlining will make the situation more clear, for sure using WALK_SUBEXPR would but it might loose the tailcall. Would you accept an additional comment after WALK_SUBEXPR_TAIL like case EXPR_OP: WALK_SUBEXPR ((*e)->value.op.op1); WALK_SUBEXPR_TAIL ((*e)->value.op.op2); /* tail-recurse */ ? Btw, a fallthru would be diagnosed by GCC unless we put /* Fallthru */ here. Maybe renaming WALK_SUBEXPR_TAIL to WALK_SUBEXPR_WITH_CONTINUE or WALK_SUBEXPR_BY_TAIL_RECURSING or WALK_SUBEXPR_TAILRECURSE would be more obvious? Thanks, Richard.