diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-05-18 23:23:07 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-05-18 23:23:07 +0200 |
commit | 960db8ec97c6b2d8381040f71b5852d1854197da (patch) | |
tree | 8d9d18a6c3039fc2f51f8f07c4a559a55dd58084 | |
parent | 78885314088bb56f3c4fa60e4f0b6dfd987b3691 (diff) | |
download | gcc-960db8ec97c6b2d8381040f71b5852d1854197da.zip gcc-960db8ec97c6b2d8381040f71b5852d1854197da.tar.gz gcc-960db8ec97c6b2d8381040f71b5852d1854197da.tar.bz2 |
re PR c++/71100 (Internal compiler error while calling a pointer to member function that throws)
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.
From-SVN: r236430
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cgraph.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr71100.C | 18 |
4 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d261f7..3b94d64 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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. + 2016-05-18 Uros Bizjak <ubizjak@gmail.com> PR target/71145 diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 6fcdbdd..cf9192f 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1515,7 +1515,8 @@ cgraph_edge::redirect_call_stmt_to_callee (void) /* 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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 66f5cba..6a684fc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/71100 + * g++.dg/opt/pr71100.C: New test. + 2016-05-18 Martin Jambor <mjambor@suse.cz> PR ipa/69708 diff --git a/gcc/testsuite/g++.dg/opt/pr71100.C b/gcc/testsuite/g++.dg/opt/pr71100.C new file mode 100644 index 0000000..ff739e2 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr71100.C @@ -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); +} |