+2020-03-19 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/94202
+ * cgraph.c (cgraph_node::function_symbol): Fix availability computation.
+ (cgraph_node::function_or_virtual_thunk_symbol): Likewise.
+
2020-03-19 Jan Hubicka <hubicka@ucw.cz>
PR ipa/92372
while (node->thunk.thunk_p)
{
+ enum availability a;
+
ref = node;
node = node->callees->callee;
- if (availability)
- {
- enum availability a;
- a = node->get_availability (ref);
- if (a < *availability)
- *availability = a;
- }
- node = node->ultimate_alias_target (availability, ref);
+ node = node->ultimate_alias_target (availability ? &a : NULL, ref);
+ if (availability && a < *availability)
+ *availability = a;
}
return node;
}
while (node->thunk.thunk_p && !node->thunk.virtual_offset_p)
{
+ enum availability a;
+
ref = node;
node = node->callees->callee;
- if (availability)
- {
- enum availability a;
- a = node->get_availability (ref);
- if (a < *availability)
- *availability = a;
- }
- node = node->ultimate_alias_target (availability, ref);
+ node = node->ultimate_alias_target (availability ? &a : NULL, ref);
+ if (availability && a < *availability)
+ *availability = a;
}
return node;
}
--- /dev/null
+// { dg-additional-options "-w" }
+struct S1 {
+ virtual ~S1();
+ virtual void v();
+};
+struct S2: S1 {};
+struct S3: S1, S2 { void v(); };
+struct S4: S3 { void v(); };
+void S4::v() { S3::v(); }
+struct R {
+ S1 * m;
+ void f(S2 * x) {
+ static_cast<S1 *>(x)->v();
+ x->v();
+ m = x;
+ }
+};
+void f() {
+ R r;
+ r.f(new S4);
+ r.f(new S3);
+}