* [PATCH] Fix another case of noreturn call with TREE_ADDRESSABLE type on lhs (PR c++/71100)
@ 2016-05-18 20:55 Jakub Jelinek
2016-05-18 21:06 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-05-18 20:55 UTC (permalink / raw)
To: Richard Biener, Jason Merrill; +Cc: gcc-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix another case of noreturn call with TREE_ADDRESSABLE type on lhs (PR c++/71100)
2016-05-18 20:55 [PATCH] Fix another case of noreturn call with TREE_ADDRESSABLE type on lhs (PR c++/71100) Jakub Jelinek
@ 2016-05-18 21:06 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2016-05-18 21:06 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Richard Biener, gcc-patches List
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-18 21:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18 20:55 [PATCH] Fix another case of noreturn call with TREE_ADDRESSABLE type on lhs (PR c++/71100) Jakub Jelinek
2016-05-18 21:06 ` Jason Merrill
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).