public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] ubsan: Fix up another spot that should have been BUILT_IN_UNREACHABLE_TRAPS [PR108655]
Date: Mon, 6 Feb 2023 08:17:48 +0100	[thread overview]
Message-ID: <CAFiYyc3q_KgM0AQFjhjo8i4=koc0_zregx82mUPALO0h76CmMQ@mail.gmail.com> (raw)
In-Reply-To: <Y91bM7eeiHWZMwWI@tucnak>

On Fri, Feb 3, 2023 at 9:15 PM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi!
>
> We ICE on the following testcase, because ivcanon calls
> gimple_build_builtin_unreachable but doesn't expect it would need vops.
> BUILT_IN_UNREACHABLE_TRAP I've introduced yesterday doesn't need
> vops and should be used in that case instead of BUILT_IN_TRAP which
> needs them.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

> 2023-02-03  Jakub Jelinek  <jakub@redhat.com>
>
>         PR tree-optimization/108655
>         * ubsan.cc (sanitize_unreachable_fn): For -funreachable-traps
>         or -fsanitize=unreachable -fsanitize-trap=unreachable return
>         BUILT_IN_UNREACHABLE_TRAP decl rather than BUILT_IN_TRAP.
>
>         * gcc.dg/pr108655.c: New test.
>
> --- gcc/ubsan.cc.jj     2023-01-02 09:32:38.393053992 +0100
> +++ gcc/ubsan.cc        2023-02-03 11:40:47.047399386 +0100
> @@ -649,7 +649,7 @@ sanitize_unreachable_fn (tree *data, loc
>        ? (flag_sanitize_trap & SANITIZE_UNREACHABLE)
>        : flag_unreachable_traps)
>      {
> -      fn = builtin_decl_explicit (BUILT_IN_TRAP);
> +      fn = builtin_decl_explicit (BUILT_IN_UNREACHABLE_TRAP);
>        *data = NULL_TREE;
>      }
>    else if (san)
> --- gcc/testsuite/gcc.dg/pr108655.c.jj  2023-02-03 11:46:39.533190031 +0100
> +++ gcc/testsuite/gcc.dg/pr108655.c     2023-02-03 11:46:28.272356439 +0100
> @@ -0,0 +1,15 @@
> +/* PR tree-optimization/108655 */
> +/* { dg-do compile } */
> +/* { dg-options "-w -O1 -funreachable-traps" } */
> +
> +void
> +foo (void)
> +{
> +  int i, j;
> +  for (; i;)
> +    ;
> +  for (; i < 6;)
> +    for (j = 0; j < 6; ++j)
> +      i += j;
> +  __builtin_trap ();
> +}
>
>         Jakub
>

      reply	other threads:[~2023-02-06  7:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 19:06 Jakub Jelinek
2023-02-06  7:17 ` Richard Biener [this message]

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='CAFiYyc3q_KgM0AQFjhjo8i4=koc0_zregx82mUPALO0h76CmMQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /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).