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 <ja...@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