From 89bbe9ba36dfcf71ab9e5d85c447f3511e7f8d97 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 3 Dec 2015 05:13:33 +0100 Subject: [PATCH] re PR c++/68184 (Exception from a virtual function does not get caught) PR ipa/68184 * g++.dg/torture/pr68184.C: New testcase. * cgraphunit.c (cgraph_node::analyze): Set can_throw_external. From-SVN: r231217 --- gcc/ChangeLog | 5 +++++ gcc/cgraphunit.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr68184.C | 31 ++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr68184.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f15b2d28fec..1d96d7b61cf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-12-02 Jan Hubicka + + PR ipa/68184 + * cgraphunit.c (cgraph_node::analyze): Set can_throw_external. + 2015-12-02 Aditya Kumar Sebastian Pop diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 4ce5f9bdd2e..4ab64147e88 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -575,6 +575,7 @@ cgraph_node::analyze (void) cgraph_node *t = cgraph_node::get (thunk.alias); create_edge (t, NULL, 0, CGRAPH_FREQ_BASE); + callees->can_throw_external = !TREE_NOTHROW (t->decl); /* Target code in expand_thunk may need the thunk's target to be analyzed, so recurse here. */ if (!t->analyzed) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7f39c2d3b52..2e9f6b817c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-02 Jan Hubicka + + PR ipa/68184 + * g++.dg/torture/pr68184.C: New testcase. + 2015-12-03 Jakub Jelinek PR preprocessor/57580 diff --git a/gcc/testsuite/g++.dg/torture/pr68184.C b/gcc/testsuite/g++.dg/torture/pr68184.C new file mode 100644 index 00000000000..d0c7c84910c --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr68184.C @@ -0,0 +1,31 @@ +// { dg-do run } +namespace { +struct IFoo { virtual void foo() = 0; }; +struct IBar { virtual void bar() = 0; }; + +struct FooBar : private IBar, private IFoo +{ + void call_foo() + { + try + { + static_cast(this)->foo(); + } + catch( ... ) {} + } + void foo() { throw 1; } + void bar() {} +}; + +void test() +{ + FooBar foobar; + foobar.call_foo(); +} +} +int main() +{ + test(); + return 0; +} + -- 2.30.2