diff options
Diffstat (limited to 'gcc/cp/decl2.cc')
-rw-r--r-- | gcc/cp/decl2.cc | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index a3149f2..21156f1 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -2482,9 +2482,7 @@ vague_linkage_p (tree decl) DECL_COMDAT. */ if (DECL_COMDAT (decl) || (TREE_CODE (decl) == FUNCTION_DECL - && DECL_DECLARED_INLINE_P (decl) - /* But gnu_inline functions are always external. */ - && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl))) + && DECL_DECLARED_INLINE_P (decl)) || (DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INSTANTIATION (decl)) || (VAR_P (decl) && DECL_INLINE_VAR_P (decl))) @@ -4603,6 +4601,23 @@ decomp_finalize_var_list (tree sl, int save_stmts_are_full_exprs_p) } } +/* Helper for emit_partial_init_fini_fn OpenMP target handling, called via + walk_tree. Set DECL_CONTEXT on any automatic temporaries which still + have it NULL to id->src_fn, so that later copy_tree_body_r can remap those. + Otherwise DECL_CONTEXT would be set only during gimplification of the host + fn and when copy_tree_body_r doesn't remap those, we'd ICE during the + target fn gimplification because the same automatic VAR_DECL can't be + used in multiple functions (with the exception of nested functions). */ + +static tree +set_context_for_auto_vars_r (tree *tp, int *, void *data) +{ + copy_body_data *id = (copy_body_data *) data; + if (auto_var_in_fn_p (*tp, NULL_TREE) && DECL_ARTIFICIAL (*tp)) + DECL_CONTEXT (*tp) = id->src_fn; + return NULL_TREE; +} + /* Generate code to do the initialization or destruction of the decls in VARS, a TREE_LIST of VAR_DECL with static storage duration. Whether initialization or destruction is performed is specified by INITP. */ @@ -4661,6 +4676,7 @@ emit_partial_init_fini_fn (bool initp, unsigned priority, tree vars, id.transform_new_cfg = true; id.transform_return_to_modify = false; id.eh_lp_nr = 0; + walk_tree (&init, set_context_for_auto_vars_r, &id, NULL); walk_tree (&init, copy_tree_body_r, &id, NULL); } /* Do one initialization or destruction. */ |