From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19551 invoked by alias); 17 Oct 2009 08:42:53 -0000 Received: (qmail 19542 invoked by uid 22791); 17 Oct 2009 08:42:52 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Oct 2009 08:42:48 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id D19B2290008; Sat, 17 Oct 2009 10:42:45 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CSaj+2nK6xy8; Sat, 17 Oct 2009 10:42:39 +0200 (CEST) Received: from [192.168.1.2] (83-153-83-223.rev.libertysurf.net [83.153.83.223]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 254A5290003; Sat, 17 Oct 2009 10:42:39 +0200 (CEST) From: Eric Botcazou To: Richard Guenther Subject: Re: [Patch] Fix bogus 'function does return' warning Date: Sat, 17 Oct 2009 10:26:00 -0000 User-Agent: KMail/1.9.6 (enterprise 20070904.708012) Cc: gcc-patches@gcc.gnu.org, Richard Henderson References: <200910152148.53899.ebotcazou@adacore.com> <84fc9c000910160421h43a685cahdd840c96153b80eb@mail.gmail.com> <200910161349.47039.ebotcazou@adacore.com> In-Reply-To: <200910161349.47039.ebotcazou@adacore.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_IPY2KzEXH0YX2iY" Message-Id: <200910171043.52316.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg01115.txt.bz2 --Boundary-00=_IPY2KzEXH0YX2iY Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 368 > I'm not sure how to extend the pass, this would mean detecting unreachable > gotos and returns. Eliminating them in "lower" seems easier, maybe I can > restrict my patch and eliminate only them. What about this? * gimple-low.c (lower_stmt) : If the call is noreturn, remove a subsequent GOTO or RETURN statement. -- Eric Botcazou --Boundary-00=_IPY2KzEXH0YX2iY Content-Type: text/x-diff; charset="iso-8859-1"; name="p.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="p.diff" Content-length: 789 Index: gimple-low.c =================================================================== --- gimple-low.c (revision 152797) +++ gimple-low.c (working copy) @@ -387,6 +387,19 @@ lower_stmt (gimple_stmt_iterator *gsi, s lower_builtin_setjmp (gsi); return; } + + /* After a noreturn call, remove a subsequent GOTO or RETURN that + might have been mechanically added. This will prevent the EH + lowering pass to add useless edges and complicate the CFG. */ + if (decl && (flags_from_decl_or_type (decl) & ECF_NORETURN)) + { + gsi_next (gsi); + if (!gsi_end_p (*gsi) + && (gimple_code (gsi_stmt (*gsi)) == GIMPLE_GOTO + || gimple_code (gsi_stmt (*gsi)) == GIMPLE_RETURN)) + gsi_remove (gsi, false); + return; + } } break; --Boundary-00=_IPY2KzEXH0YX2iY--