public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@vnet.ibm.com>
To: Richard Biener <rguenther@suse.de>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	       Bill Schmidt <wschmidt@linux.vnet.ibm.com>,
	       Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch
Date: Thu, 20 Apr 2017 14:21:00 -0000	[thread overview]
Message-ID: <5bccbce6-5eb5-65a4-619f-55a04a286a5a@vnet.ibm.com> (raw)
In-Reply-To: <alpine.LSU.2.20.1704200932300.24645@zhemvz.fhfr.qr>

On 4/20/17 2:37 AM, Richard Biener wrote:
> Ok, so I think we should ensure that we remove the regular cases
> with unreachable destination, like in
> 
> switch (i)
> {
> case 0:
>   __builtin_unreachable ();
> default:;
> }
> 
> and handle default with __builtin_unreachable () from switch
> expansion by omitting the range check for the jump table
> indexing (and choose a non-default case label for gaps).

Ok, I'll modify optimize_unreachable() to remove the unreachable
case statements, and leave the unreachable default case statement
for switch expansion so we can eliminate the range check.  Thanks.

Peter

  reply	other threads:[~2017-04-20 13:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  0:29 Peter Bergner
2017-04-13  8:14 ` Richard Biener
2017-04-13 11:07   ` Jakub Jelinek
2017-04-13 20:06   ` Peter Bergner
2017-04-20  8:08     ` Richard Biener
2017-04-20 14:21       ` Peter Bergner [this message]
2017-04-27  5:08         ` [PATCH, v3] " Peter Bergner
2017-04-27 12:46           ` Bernhard Reutner-Fischer
2017-04-27 15:16             ` Peter Bergner
2017-05-03 13:43           ` Richard Biener
2017-05-08 16:51             ` Peter Bergner
2017-05-08 17:57               ` Richard Biener
2017-05-08 18:26                 ` Peter Bergner
2017-05-08 20:55                   ` Peter Bergner
2017-05-09  7:57                     ` Richard Biener

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=5bccbce6-5eb5-65a4-619f-55a04a286a5a@vnet.ibm.com \
    --to=bergner@vnet.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    --cc=wschmidt@linux.vnet.ibm.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).