aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2020-03-20 00:42:13 +0100
committerJan Hubicka <jh@suse.cz>2020-03-20 00:42:13 +0100
commitf7dceb4e658399edfbf8dd0e08ce0c686bfa2c9d (patch)
treebd112e021c4db6ecd2cf89f3b21c152e0ee55fb9 /gcc/testsuite/g++.dg
parent9def91e9f2a7051c9c146f16c1a10d1b25d33b47 (diff)
downloadgcc-f7dceb4e658399edfbf8dd0e08ce0c686bfa2c9d.zip
gcc-f7dceb4e658399edfbf8dd0e08ce0c686bfa2c9d.tar.gz
gcc-f7dceb4e658399edfbf8dd0e08ce0c686bfa2c9d.tar.bz2
Fix cgraph_node::function_symbol availability compuattion [PR94202]
this fixes ICE in inliner cache sanity check which is caused by very old bug in visibility calculation in cgraph_node::function_symbol and cgraph_node::function_or_virtual_thunk_symbol. In the testcase there is indirect call to a thunk. At begining we correctly see that its body as AVAIL_AVAILABLE but later we inline into the thunk and this turns it to AVAIL_INTERPOSABLE. This is because function_symbol incorrectly overwrites availability parameter by availability of the alias used in the call within thunk, which is a local alias. gcc/ChangeLog: 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. gcc/testsuite/ChangeLog: 2020-03-19 Jan Hubicka <hubicka@ucw.cz> PR ipa/94202 * g++.dg/torture/pr94202.C: New test.
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/torture/pr94202.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/pr94202.C b/gcc/testsuite/g++.dg/torture/pr94202.C
new file mode 100644
index 0000000..5ed3dcb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr94202.C
@@ -0,0 +1,22 @@
+// { 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);
+}