public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Marek Polacek <polacek@redhat.com>,
	       Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Biener <rguenther@suse.de>
Subject: Re: [PATCH] Fix libgo breakage (PR tree-optimization/67284)
Date: Fri, 21 Aug 2015 15:05:00 -0000	[thread overview]
Message-ID: <55D738F0.1000109@redhat.com> (raw)
In-Reply-To: <20150821144122.GL2729@redhat.com>

On 08/21/2015 08:41 AM, Marek Polacek wrote:
> On Fri, Aug 21, 2015 at 03:37:38PM +0200, Richard Biener wrote:
>> On Fri, Aug 21, 2015 at 2:49 PM, Marek Polacek <polacek@redhat.com> wrote:
>>> On Fri, Aug 21, 2015 at 01:27:43PM +0200, Richard Biener wrote:
>>>> On Fri, Aug 21, 2015 at 12:52 PM, Marek Polacek <polacek@redhat.com> wrote:
>>>>> This fixes the libgo breakage.  Seems I really should have removed the
>>>>> edge after we split the block with null dereference after __builtin_trap
>>>>> statement so that it's unreachable.
>>>>>
>>>>> Bootstrapped/regtested on x86_64-linux + ppc64-linux + bootstrapped on
>>>>> aarch64-linux, ok for trunk?
>>>>
>>>> Hum.  I don't see why this is needed - CFG cleanup (which of course needs
>>>> to run!) should do this for you.  In fact stray unreachable blocks are usually
>>>> more of a problem.
>>>
>>> Aha.  It seems cleanup does that if I change the code to generate
>>> __builtin_unreachable instead of __builtin_trap.  A hint maybe? ;)
>>
>> Not really...
>>
>> static bool
>> cleanup_control_flow_bb (basic_block bb)
>> {
>> ...
>>    /* Check for indirect calls that have been turned into
>>       noreturn calls.  */
>>    else if (is_gimple_call (stmt)
>>             && gimple_call_noreturn_p (stmt)
>>             && remove_fallthru_edge (bb->succs))
>>      retval = true;
>>
>> and __builtin_trap is NORETURN.  But there is the hint where to debug.
>
> Yes, but gimple_call_noreturn_p is false on __builtin_trap.  That's quite
> confusing... but flags_from_decl_or_type really returns 0 for __builtin_trap.
>
> So can't we use __builtin_unreachable in isolate-path code?
No, we really want the trap to halt execution rather than executing 
whatever code is following in the instruction stream.  The latter is a 
significant security problem.



jeff

  reply	other threads:[~2015-08-21 14:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 11:00 Marek Polacek
2015-08-21 12:07 ` Richard Biener
2015-08-21 12:50   ` Marek Polacek
2015-08-21 13:40     ` Richard Biener
2015-08-21 14:43       ` Marek Polacek
2015-08-21 15:05         ` Jeff Law [this message]
2015-08-21 15:37         ` Jeff Law
2015-08-21 16:23           ` Richard Biener
2015-08-21 16:30           ` Richard Biener
2015-08-21 16:52             ` Marek Polacek
2015-08-21 17:31               ` Richard Biener
2015-08-24  9:17                 ` Jakub Jelinek
2015-08-24  9:23                   ` Marek Polacek

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=55D738F0.1000109@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@redhat.com \
    --cc=rguenther@suse.de \
    --cc=richard.guenther@gmail.com \
    /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).