Blame SOURCES/gcc48-pr68184.patch

4dd737
2017-02-28  Jakub Jelinek  <jakub@redhat.com>
4dd737
4dd737
	Backport from mainline
4dd737
	2015-12-02  Jan Hubicka  <hubicka@ucw.cz>
4dd737
4dd737
	PR ipa/68184
4dd737
	* cgraphunit.c (cgraph_node::analyze): Set can_throw_external.
4dd737
4dd737
	* g++.dg/torture/pr68184.C: New testcase.
4dd737
4dd737
--- gcc/cgraphunit.c.jj	2014-09-10 09:15:51.000000000 +0200
4dd737
+++ gcc/cgraphunit.c	2017-02-28 08:24:44.387385510 +0100
4dd737
@@ -626,8 +626,10 @@ cgraph_analyze_function (struct cgraph_n
4dd737
     }
4dd737
   else if (node->thunk.thunk_p)
4dd737
     {
4dd737
-      cgraph_create_edge (node, cgraph_get_node (node->thunk.alias),
4dd737
-			  NULL, 0, CGRAPH_FREQ_BASE);
4dd737
+      struct cgraph_node *t = cgraph_get_node (node->thunk.alias);
4dd737
+      cgraph_create_edge (node, t, NULL, 0,
4dd737
+			  CGRAPH_FREQ_BASE)->can_throw_external
4dd737
+	= !TREE_NOTHROW (t->symbol.decl);
4dd737
     }
4dd737
   else if (node->dispatcher_function)
4dd737
     {
4dd737
--- gcc/testsuite/g++.dg/torture/pr68184.C.jj	2017-02-28 08:26:09.205246069 +0100
4dd737
+++ gcc/testsuite/g++.dg/torture/pr68184.C	2015-12-03 16:39:34.589010321 +0100
4dd737
@@ -0,0 +1,31 @@
4dd737
+// { dg-do run }
4dd737
+namespace {
4dd737
+struct IFoo { virtual void foo() = 0; };
4dd737
+struct IBar { virtual void bar() = 0; };
4dd737
+
4dd737
+struct FooBar : private IBar, private IFoo
4dd737
+{
4dd737
+    void call_foo()
4dd737
+    {
4dd737
+        try
4dd737
+        {
4dd737
+            static_cast<IFoo*>(this)->foo();
4dd737
+        }
4dd737
+        catch( ... ) {}
4dd737
+    }
4dd737
+    void foo() { throw 1; }
4dd737
+    void bar()  {}
4dd737
+};
4dd737
+
4dd737
+void test()
4dd737
+{
4dd737
+    FooBar foobar;
4dd737
+    foobar.call_foo();
4dd737
+}
4dd737
+}
4dd737
+int main()
4dd737
+{
4dd737
+    test();
4dd737
+    return 0;
4dd737
+}
4dd737
+