From: Richard Guenther <richard.guenther@gmail.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [Patch] Fix bogus 'function does return' warning
Date: Fri, 16 Oct 2009 09:50:00 -0000 [thread overview]
Message-ID: <84fc9c000910160244l6e38fdc9ga9063d8a047e58bb@mail.gmail.com> (raw)
In-Reply-To: <200910152148.53899.ebotcazou@adacore.com>
On Thu, Oct 15, 2009 at 9:48 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> the GIMPLE EH patch introduced a regression for the attached testcase: a
> bogus 'function does return' is now issued.
>
> The problem is that the EH pass turns
>
> D.2142 = &"p.adb"[0];
> .gnat_rcheck_20 (D.2142, 7);
> <D.2137>:
> D.2143 = &"p.adb"[0];
> .gnat_rcheck_04 (D.2143, 9);
> goto <D.2151>;
> }
> finally
> {
> p.error (); [static-chain: &FRAME.8]
> }
> <D.2151>:
> return;
>
> into
>
> D.2142 = &"p.adb"[0];
> .gnat_rcheck_20 (D.2142, 7);
> <D.2137>:
> D.2143 = &"p.adb"[0];
> .gnat_rcheck_04 (D.2143, 9);
> finally_tmp.10 = 0;
> goto <D.2156>;
> <D.2156>:
> p.error (); [static-chain: &FRAME.8]
> switch (finally_tmp.10) <default: <D.2159>, default: <D.2159>, case 1:
> <D.2158>>
> <D.2159>:
> goto <D.2151>;
> <D.2151>:
> return;
> <D.2157>:
> finally_tmp.10 = 1;
> goto <D.2156>;
> <D.2158>:
> resx 1
>
> thus masking the fact that D.2159 and D.2151 are unreachable. So the CFG ends
> up being
>
> <bb 21>:
> D.2143 = &"p.adb"[0];
> .gnat_rcheck_04 (D.2143, 9);
>
> <L17>:
> return;
>
> <L19>:
> finally_tmp.10 = 1;
> p.error (); [static-chain: &FRAME.8]
> switch (finally_tmp.10) <default: <L17>, case 1: <L20>>
>
> <L20>:
> resx 1
>
> and the EXIT block has a predecessor, hence the warning.
>
>
> The proposed fix is to remove unreachable statements after noreturn calls
> during the "lower" pass. Tested on i586-suse-linux, OK for mainline?
Huh. I wonder why the unreachable blocks are not removed
after CFG build? After all noreturn calls end BBs.
Am I missing sth?
Richard.
>
> 2009-10-15 Eric Botcazou <ebotcazou@adacore.com>
>
> * gimple-low.c (lower_stmt) <GIMPLE_CALL>: If the call is noreturn,
> remove subsequent regular statements in the sequence.
>
>
> 2009-10-15 Eric Botcazou <ebotcazou@adacore.com>
>
> * gnat.dg/noreturn1.ad[sb]: New test.
>
>
> --
> Eric Botcazou
>
next prev parent reply other threads:[~2009-10-16 9:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 19:51 Eric Botcazou
2009-10-16 9:50 ` Richard Guenther [this message]
2009-10-16 9:55 ` Eric Botcazou
2009-10-16 10:38 ` Richard Guenther
2009-10-16 11:12 ` Eric Botcazou
2009-10-16 11:32 ` Richard Guenther
2009-10-16 13:21 ` Eric Botcazou
2009-10-17 10:26 ` Eric Botcazou
2009-10-17 11:29 ` Richard Guenther
2009-10-17 11:36 ` Eric Botcazou
2009-10-17 14:12 ` Richard Guenther
2009-10-17 17:00 ` Richard Henderson
2009-10-17 17:10 ` Richard Guenther
2009-10-18 15:49 ` Eric Botcazou
2009-10-18 16:36 ` Richard Henderson
2009-10-18 18:41 ` Eric Botcazou
2009-10-19 15:39 ` Richard Henderson
2009-10-19 17:32 ` Eric Botcazou
2009-10-19 18:30 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84fc9c000910160244l6e38fdc9ga9063d8a047e58bb@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).