diff options
author | Martin Liska <mliska@suse.cz> | 2021-03-03 09:38:55 +0100 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-03-16 10:54:23 -0400 |
commit | 1c7bec8bfbc5457c1b57d0e3b67f5d6bc8812e57 (patch) | |
tree | cfb2c3641e076ce41f60e86f757cd17b4263ca63 /gcc/cp/name-lookup.c | |
parent | f6e9c1c9191c8b9998e03cb15de8600a2a4b9188 (diff) | |
download | gcc-1c7bec8bfbc5457c1b57d0e3b67f5d6bc8812e57.zip gcc-1c7bec8bfbc5457c1b57d0e3b67f5d6bc8812e57.tar.gz gcc-1c7bec8bfbc5457c1b57d0e3b67f5d6bc8812e57.tar.bz2 |
c++: support target attr for DECL_LOCAL_DECL_P fns [PR99108]
We crash when target attribute get_function_versions_dispatcher is called
for a function that is not registered in call graph. This was happening
because we were calling it for the function-local decls that aren't in the
symbol table, instead of the corresponding namespace-scope decls that are.
gcc/cp/ChangeLog:
PR c++/99108
* call.c (get_function_version_dispatcher): Handle
DECL_LOCAL_DECL_P.
* decl.c (maybe_version_functions): Likewise.
(maybe_mark_function_versioned): New.
* name-lookup.c (push_local_extern_decl_alias): No longer static.
* name-lookup.h (push_local_extern_decl_alias): Adjust.
gcc/testsuite/ChangeLog:
PR c++/99108
* g++.target/i386/pr99108.C: New test.
Co-authored-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 9382a47..a6257f5 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3374,7 +3374,7 @@ set_decl_context_in_fn (tree ctx, tree decl) /* DECL is a local extern decl. Find or create the namespace-scope decl that it aliases. Also, determines the linkage of DECL. */ -static void +void push_local_extern_decl_alias (tree decl) { if (dependent_type_p (TREE_TYPE (decl))) @@ -3408,7 +3408,7 @@ push_local_extern_decl_alias (tree decl) if (binding && TREE_CODE (binding) != TREE_LIST) for (ovl_iterator iter (binding); iter; ++iter) - if (decls_match (*iter, decl)) + if (decls_match (decl, *iter, /*record_versions*/false)) { alias = *iter; break; |