https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96390
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
omp-offload.c's omp_discover_declare_target_tgt_fn_r sees the
<function_decl 0x7ffff7647c00 __ct_comp
full-name "S<0>::S()"
It does not call
((vec<tree> *) 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) 0x7ffff7648e00
(gdb) p debug_tree((*tp)->decl_common.attributes)
<tree_list 0x7ffff765b1e0
purpose <identifier_node 0x7ffff7653400 omp declare target
normal local bindings <(nil)>>>
But later in dump_function_to_file:
(gdb) p fndecl
$30 = (tree) 0x7ffff7648f00
(gdb) p debug_tree(fndecl->decl_common.attributes)
$31 = void
Thus, there is now a different tree – with DECL_ATTRIBUTES stripped.