[Bug middle-end/96390] [OpenMP] Link errors on the offload side for C++ code with templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96390 Tobias Burnus changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #5 from Tobias Burnus --- FIXED on GCC 11 (= mainline).
[Bug middle-end/96390] [OpenMP] Link errors on the offload side for C++ code with templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96390 --- Comment #4 from CVS Commits --- The master branch has been updated by Tobias Burnus : https://gcc.gnu.org/g:2a10a2c0689db280ee3a94164504b7196b8370f4 commit r11-3505-g2a10a2c0689db280ee3a94164504b7196b8370f4 Author: Tobias Burnus Date: Mon Sep 28 18:08:05 2020 +0200 OpenMP: Handle cpp_implicit_alias in declare-target discovery (PR96390) gcc/ChangeLog: PR middle-end/96390 * omp-offload.c (omp_discover_declare_target_tgt_fn_r): Handle alias nodes. libgomp/ChangeLog: PR middle-end/96390 * testsuite/libgomp.c++/pr96390.C: New test. * testsuite/libgomp.c-c++-common/pr96390.c: New test.
[Bug middle-end/96390] [OpenMP] Link errors on the offload side for C++ code with templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96390 --- Comment #3 from Tobias Burnus --- The following helps with the "S<0>::S()" problem – but then one runs into the "V<1>::V" problem. --- a/gcc/omp-offload.c +++ b/gcc/omp-offload.c @@ -207,6 +207,12 @@ omp_discover_declare_target_tgt_fn_r (tree *tp, int symtab_node *node = symtab_node::get (*tp); if (node != NULL) { + if (node->cpp_implicit_alias) + { + node = node->get_alias_target (); + DECL_ATTRIBUTES (node->decl) + = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (node->decl)); + } node->offloadable = 1; if (ENABLE_OFFLOADING) g->have_offload = true;
[Bug middle-end/96390] [OpenMP] Link errors on the offload side for C++ code with templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96390 --- Comment #2 from Tobias Burnus --- omp-offload.c's omp_discover_declare_target_tgt_fn_r sees the ::S()" It does not call ((vec *) data)->safe_push (*tp); to add it to the work list. (→ follow up issue for "V"?) However, it sets the attribute (+ updates the node); in omp_discover_declare_target_tgt_fn_r: (gdb) p *tp $27 = (tree) 0x77648e00 (gdb) p debug_tree((*tp)->decl_common.attributes) >> But later in dump_function_to_file: (gdb) p fndecl $30 = (tree) 0x77648f00 (gdb) p debug_tree(fndecl->decl_common.attributes) $31 = void Thus, there is now a different tree – with DECL_ATTRIBUTES stripped.
[Bug middle-end/96390] [OpenMP] Link errors on the offload side for C++ code with templates
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96390 --- Comment #1 from Tobias Burnus --- Created attachment 48961 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48961&action=edit Test case from https://bugs.llvm.org/show_bug.cgi?id=43771 (basis for sollve_vv test case, by Jonas Hahnfeld)