public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: marxin <mliska@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 2/5] Get bounds for a PARM_DECL (PR ipa/79761).
Date: Tue, 07 Mar 2017 14:57:00 -0000	[thread overview]
Message-ID: <CAFiYyc2_TCGtKEjPaof4RWbw1F61Mj83nooMLZoBtarn9BSG-Q@mail.gmail.com> (raw)
In-Reply-To: <b1f80139b20c1a0e462b85881702f11d57314c81.1488881229.git.mliska@suse.cz>

On Thu, Mar 2, 2017 at 6:06 PM, marxin <mliska@suse.cz> wrote:
> gcc/ChangeLog:
>
> 2017-03-06  Martin Liska  <mliska@suse.cz>
>
>         PR ipa/79761
>         * tree-chkp.c (chkp_get_bound_for_parm): Get bounds for a param.
>         (chkp_find_bounds_1): Remove gcc_unreachable.
>
> gcc/testsuite/ChangeLog:
>
> 2017-03-06  Martin Liska  <mliska@suse.cz>
>
>         PR ipa/79761
>         * g++.dg/pr79761.C: New test.
> ---
>  gcc/testsuite/g++.dg/pr79761.C | 34 ++++++++++++++++++++++++++++++++++
>  gcc/tree-chkp.c                |  3 +--
>  2 files changed, 35 insertions(+), 2 deletions(-)
>  create mode 100644 gcc/testsuite/g++.dg/pr79761.C
>
> diff --git a/gcc/testsuite/g++.dg/pr79761.C b/gcc/testsuite/g++.dg/pr79761.C
> new file mode 100644
> index 00000000000..b1f92d2b036
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/pr79761.C
> @@ -0,0 +1,34 @@
> +/* { dg-do compile { target { ! x32 } } } */
> +/* { dg-options "-fcheck-pointer-bounds -mmpx -mabi=ms" } */
> +
> +struct Foo
> +{
> +  Foo() : a(1), b(1), c('a') {}
> +  int a;
> +  int b;
> +  char c;
> +};
> +
> +static Foo copy_foo(Foo) __attribute__((noinline, noclone));
> +
> +static Foo copy_foo(Foo A)
> +{
> +  return A;
> +}
> +
> +struct Bar : Foo
> +{
> +  Bar(Foo t) : Foo(copy_foo(t)) {}
> +};
> +
> +Foo F;
> +
> +int main (void)
> +{
> +  Bar B (F);
> +
> +  if (B.a != 1 || B.b != 1 || B.c != 'a')
> +    __builtin_abort ();
> +
> +  return 0;
> +}
> diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
> index 3d497f51ed8..d5683b1b9cf 100644
> --- a/gcc/tree-chkp.c
> +++ b/gcc/tree-chkp.c
> @@ -2353,7 +2353,7 @@ chkp_get_next_bounds_parm (tree parm)
>  static tree
>  chkp_get_bound_for_parm (tree parm)
>  {
> -  tree decl = SSA_NAME_VAR (parm);
> +  tree decl = TREE_CODE (parm) == PARM_DECL ? parm : SSA_NAME_VAR (parm);
>    tree bounds;
>
>    gcc_assert (TREE_CODE (decl) == PARM_DECL);
> @@ -3602,7 +3602,6 @@ chkp_find_bounds_1 (tree ptr, tree ptr_src, gimple_stmt_iterator *iter)
>        break;
>
>      case PARM_DECL:
> -      gcc_unreachable ();
>        bounds = chkp_get_bound_for_parm (ptr_src);

But this is just useless work ... just do

      case PARM_DECL:
         /* Handled above but failed.  */
         break;

the SSA_NAME case is similarly redundantly calling chkp_get_registered_bounds.

Richard.

>        break;
>
> --
> 2.11.1
>
>

  parent reply	other threads:[~2017-03-07 14:57 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07 10:09 [PATCH 0/5] Fix various MPX issues marxin
2017-03-07 10:09 ` [PATCH 2/5] Get bounds for a PARM_DECL (PR ipa/79761) marxin
2017-03-07 10:16   ` Rainer Orth
2017-03-07 14:48     ` Martin Liška
2017-03-07 14:57   ` Richard Biener [this message]
2017-03-07 16:07     ` Martin Liška
2017-03-07 16:17       ` Jeff Law
2017-03-08 11:01       ` Richard Biener
2017-03-07 10:09 ` [PATCH 4/5] Disable -fcheck-pointer-bounds with sanitizers marxin
2017-03-07 16:12   ` Jeff Law
2017-03-07 16:21   ` Jakub Jelinek
2017-03-09 10:02     ` Martin Liška
2017-03-10 13:09     ` [PATCH] MPX: Fix option handling Martin Liška
2017-03-10 13:14       ` Jakub Jelinek
2017-03-17 12:17         ` Rainer Orth
2017-03-21 11:21           ` Martin Liška
2017-03-07 10:09 ` [PATCH 5/5] Support BIT_FIELD_REF in MPX (PR ipa/79764) marxin
2017-03-07 10:18   ` Rainer Orth
2017-03-07 14:49     ` Martin Liška
2017-03-07 15:00       ` Richard Biener
2017-03-07 10:09 ` [PATCH 1/5] Fix *_CST ICEs connected to MPX marxin
2017-03-07 10:17   ` Rainer Orth
2017-03-07 14:48     ` Martin Liška
2017-03-07 14:53       ` Richard Biener
2017-03-07 16:01         ` Martin Liška
2017-03-08 11:00           ` Richard Biener
2017-03-09 11:40             ` Martin Liška
2017-03-13 12:28               ` Richard Biener
2017-03-13 13:02                 ` Martin Liška
2017-03-13 13:08                   ` Richard Biener
2017-03-13 13:33                     ` Martin Liška
2017-03-14 23:58                       ` Ilya Enkovich
2017-03-15 10:12                         ` Martin Liška
2017-03-15 17:09                           ` Jeff Law
2017-03-07 10:09 ` [PATCH 3/5] Fix ICE in tree-chkp-opt.c (PR tree-optimization/79631) marxin
2017-03-09  9:36   ` Martin Liška
2017-03-09 10:05   ` Richard Biener
2017-03-09 10:12     ` Martin Liška
2017-03-09 14:19 ` [PATCH 6/N] Do not warn -Wsuggest-attribute=noreturn for main.chkp (PR, middle-end/78339) Martin Liška
2017-03-13 12:29   ` 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=CAFiYyc2_TCGtKEjPaof4RWbw1F61Mj83nooMLZoBtarn9BSG-Q@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /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).