re PR c++/68184 (Exception from a virtual function does not get caught)
authorJan Hubicka <hubicka@ucw.cz>
Thu, 3 Dec 2015 04:13:33 +0000 (05:13 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 3 Dec 2015 04:13:33 +0000 (04:13 +0000)
PR ipa/68184
* g++.dg/torture/pr68184.C: New testcase.
* cgraphunit.c (cgraph_node::analyze): Set can_throw_external.

From-SVN: r231217

gcc/ChangeLog
gcc/cgraphunit.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr68184.C [new file with mode: 0644]

index f15b2d28fec50434ca4d610f6e282f282f134b0c..1d96d7b61cfbd1d4d56be467aca541f629d79e5e 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-02  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/68184
+       * cgraphunit.c (cgraph_node::analyze): Set can_throw_external.
+
 2015-12-02  Aditya Kumar  <aditya.k7@samsung.com>
            Sebastian Pop  <s.pop@samsung.com>
 
index 4ce5f9bdd2e2da58abcab685e30ed14727045220..4ab64147e88c9435e39d822f8f9f1f62863ca826 100644 (file)
@@ -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)
index 7f39c2d3b52a0d11dd16fb6acadc75e77f9880fc..2e9f6b817c6cd5ac4dddae34a97387fc2ed0fc97 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-02  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/68184
+       * g++.dg/torture/pr68184.C: New testcase.
+
 2015-12-03  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..d0c7c84
--- /dev/null
@@ -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<IFoo*>(this)->foo();
+        }
+        catch( ... ) {}
+    }
+    void foo() { throw 1; }
+    void bar()  {}
+};
+
+void test()
+{
+    FooBar foobar;
+    foobar.call_foo();
+}
+}
+int main()
+{
+    test();
+    return 0;
+}
+