aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 4ab26d3..ae7a52f 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -8479,15 +8479,16 @@ add_decl_expr (tree gnu_decl, Node_Id gnat_node)
MARK_VISITED (DECL_SIZE_UNIT (gnu_decl));
MARK_VISITED (DECL_INITIAL (gnu_decl));
}
- /* In any case, we have to deal with our own TYPE_ADA_SIZE field. */
- else if (TREE_CODE (gnu_decl) == TYPE_DECL
- && RECORD_OR_UNION_TYPE_P (type)
- && !TYPE_FAT_POINTER_P (type))
- MARK_VISITED (TYPE_ADA_SIZE (type));
}
else
add_stmt_with_node (gnu_stmt, gnat_node);
+ /* Mark our TYPE_ADA_SIZE field now since it will not be gimplified. */
+ if (TREE_CODE (gnu_decl) == TYPE_DECL
+ && RECORD_OR_UNION_TYPE_P (type)
+ && !TYPE_FAT_POINTER_P (type))
+ MARK_VISITED (TYPE_ADA_SIZE (type));
+
/* If this is a variable and an initializer is attached to it, it must be
valid for the context. Similar to init_const in create_var_decl. */
if (TREE_CODE (gnu_decl) == VAR_DECL
@@ -10611,7 +10612,7 @@ make_alias_for_thunk (tree target)
return alias;
}
-/* Create the covariant part of the {GNAT,GNU}_THUNK. */
+/* Create the local covariant part of {GNAT,GNU}_THUNK. */
static tree
make_covariant_thunk (Entity_Id gnat_thunk, tree gnu_thunk)
@@ -10622,6 +10623,11 @@ make_covariant_thunk (Entity_Id gnat_thunk, tree gnu_thunk)
gnu_name, TREE_TYPE (gnu_thunk));
DECL_ARGUMENTS (gnu_cv_thunk) = copy_list (DECL_ARGUMENTS (gnu_thunk));
+ for (tree param_decl = DECL_ARGUMENTS (gnu_cv_thunk);
+ param_decl;
+ param_decl = DECL_CHAIN (param_decl))
+ DECL_CONTEXT (param_decl) = gnu_cv_thunk;
+
DECL_RESULT (gnu_cv_thunk) = copy_node (DECL_RESULT (gnu_thunk));
DECL_CONTEXT (DECL_RESULT (gnu_cv_thunk)) = gnu_cv_thunk;
@@ -10629,7 +10635,6 @@ make_covariant_thunk (Entity_Id gnat_thunk, tree gnu_thunk)
DECL_CONTEXT (gnu_cv_thunk) = DECL_CONTEXT (gnu_thunk);
TREE_READONLY (gnu_cv_thunk) = TREE_READONLY (gnu_thunk);
TREE_THIS_VOLATILE (gnu_cv_thunk) = TREE_THIS_VOLATILE (gnu_thunk);
- TREE_PUBLIC (gnu_cv_thunk) = TREE_PUBLIC (gnu_thunk);
DECL_ARTIFICIAL (gnu_cv_thunk) = 1;
return gnu_cv_thunk;
@@ -10759,6 +10764,12 @@ maybe_make_gnu_thunk (Entity_Id gnat_thunk, tree gnu_thunk)
cgraph_node *target_node = cgraph_node::get_create (gnu_target);
+ /* We may also need to create an alias for the target in order to make
+ the call local, depending on the linkage of the target. */
+ tree gnu_alias = use_alias_for_thunk_p (gnu_target)
+ ? make_alias_for_thunk (gnu_target)
+ : gnu_target;
+
/* If the return type of the target is a controlling type, then we need
both an usual this thunk and a covariant thunk in this order:
@@ -10771,17 +10782,11 @@ maybe_make_gnu_thunk (Entity_Id gnat_thunk, tree gnu_thunk)
tree gnu_cv_thunk = make_covariant_thunk (gnat_thunk, gnu_thunk);
target_node->create_thunk (gnu_cv_thunk, gnu_target, false,
- fixed_offset, 0, 0,
- NULL_TREE, gnu_target);
+ NULL_TREE, gnu_alias);
- gnu_target = gnu_cv_thunk;
+ gnu_alias = gnu_target = gnu_cv_thunk;
}
- /* We may also need to create an alias for the target in order to make
- the call local, depending on the linkage of the target. */
- tree gnu_alias = use_alias_for_thunk_p (gnu_target)
- ? make_alias_for_thunk (gnu_target)
- : gnu_target;
-
target_node->create_thunk (gnu_thunk, gnu_target, true,
fixed_offset, virtual_value, indirect_offset,
virtual_offset, gnu_alias);