diff options
author | Jan Hubicka <jh@suse.cz> | 2020-03-20 00:42:13 +0100 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-03-20 00:42:13 +0100 |
commit | f7dceb4e658399edfbf8dd0e08ce0c686bfa2c9d (patch) | |
tree | bd112e021c4db6ecd2cf89f3b21c152e0ee55fb9 /gcc/cgraph.c | |
parent | 9def91e9f2a7051c9c146f16c1a10d1b25d33b47 (diff) | |
download | gcc-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/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 9f0774f..b41dea1 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3788,16 +3788,13 @@ cgraph_node::function_symbol (enum availability *availability, 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; } @@ -3818,16 +3815,13 @@ cgraph_node::function_or_virtual_thunk_symbol 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; } |