public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
	gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix another case of noreturn call with TREE_ADDRESSABLE type on lhs (PR c++/71100)
Date: Wed, 18 May 2016 21:06:00 -0000	[thread overview]
Message-ID: <CADzB+2kkob87UiT7DaY_yeC47zgKvKt9K1ORVdEuQ6AEf7UmCw@mail.gmail.com> (raw)
In-Reply-To: <20160518205517.GT28550@tucnak.redhat.com>

OK.

Jason


On Wed, May 18, 2016 at 4:55 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> In 6+ we require that lhs is present if the return type of a call is
> TREE_ADDRESSABLE, apparently this function has been missed.
>
> Fixed thusly, bootstrapped/regtested (at r236371, later trunk fails
> miserably on both x86_64-linux and i686-linux), ok for trunk/6.2?
>
> 2016-05-18  Jakub Jelinek  <jakub@redhat.com>
>
>         PR c++/71100
>         * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Don't drop
>         lhs if it has TREE_ADDRESSABLE type.
>
>         * g++.dg/opt/pr71100.C: New test.
>
> --- gcc/cgraph.c.jj     2016-05-16 18:53:43.000000000 +0200
> +++ gcc/cgraph.c        2016-05-18 10:53:39.491189469 +0200
> @@ -1515,7 +1515,8 @@ cgraph_edge::redirect_call_stmt_to_calle
>    /* If the call becomes noreturn, remove the LHS if possible.  */
>    if (lhs
>        && (gimple_call_flags (new_stmt) & ECF_NORETURN)
> -      && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST)
> +      && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST
> +      && !TREE_ADDRESSABLE (TREE_TYPE (lhs)))
>      {
>        if (TREE_CODE (lhs) == SSA_NAME)
>         {
> --- gcc/testsuite/g++.dg/opt/pr71100.C.jj       2016-05-18 10:56:12.798070065 +0200
> +++ gcc/testsuite/g++.dg/opt/pr71100.C  2016-05-18 10:56:07.974136754 +0200
> @@ -0,0 +1,18 @@
> +// PR c++/71100
> +// { dg-do compile }
> +// { dg-options "-O2" }
> +
> +struct D { ~D (); };
> +struct E { D foo () { throw 1; } };
> +
> +inline void
> +bar (D (E::*f) (), E *o)
> +{
> +  (o->*f) ();
> +}
> +
> +void
> +baz (E *o)
> +{
> +  bar (&E::foo, o);
> +}
>
>         Jakub

      reply	other threads:[~2016-05-18 21:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 20:55 Jakub Jelinek
2016-05-18 21:06 ` Jason Merrill [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=CADzB+2kkob87UiT7DaY_yeC47zgKvKt9K1ORVdEuQ6AEf7UmCw@mail.gmail.com \
    --to=jason@redhat.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).