diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2010-08-30 15:59:45 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2010-08-30 15:59:45 +0000 |
commit | ae4235508ed13b83b8ffdba19829119e937205fe (patch) | |
tree | 79c5afbd64c3dc192e8f62d52cce15063a486f45 /gcc/ada | |
parent | 2e481a2ff50e75ef3b8efb6644b41a260f813d3a (diff) | |
download | gcc-ae4235508ed13b83b8ffdba19829119e937205fe.zip gcc-ae4235508ed13b83b8ffdba19829119e937205fe.tar.gz gcc-ae4235508ed13b83b8ffdba19829119e937205fe.tar.bz2 |
trans.c (call_to_gnu): Also force the return slot opt for the call to a function whose return type was...
* gcc-interface/trans.c (call_to_gnu): Also force the return slot opt
for the call to a function whose return type was unconstrained.
From-SVN: r163648
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 13 |
2 files changed, 17 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5b427f8..076efea 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,8 +1,13 @@ +2010-08-30 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/trans.c (call_to_gnu): Also force the return slot opt + for the call to a function whose return type was unconstrained. + 2010-08-30 Olivier Hainque <hainque@adacore.com> - * gcc-interface/decl.c (FOREIGN_FORCE_REALIGN_STACK): New macro, - replacement for FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN. - (gnat_to_gnu_entity) <case ..., E_Procedure>: Use it. + * gcc-interface/decl.c (FOREIGN_FORCE_REALIGN_STACK): New macro, + replacement for FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN. + (gnat_to_gnu_entity) <case ..., E_Procedure>: Use it. 2010-08-21 Eric Botcazou <ebotcazou@adacore.com> diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index d32639a..b403189 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -2992,6 +2992,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) if (gnu_target) { Node_Id gnat_parent = Parent (gnat_node); + tree gnu_result_type = TREE_TYPE (gnu_subprog_type); enum tree_code op_code; /* If range check is needed, emit code to generate it. */ @@ -3002,11 +3003,15 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) /* ??? If the return type has non-constant size, then force the return slot optimization as we would not be able to generate - a temporary. That's what has been done historically. */ - if (TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_subprog_type)))) - op_code = MODIFY_EXPR; - else + a temporary. Likewise if it was unconstrained as we would + copy too much data. That's what has been done historically. */ + if (!TREE_CONSTANT (TYPE_SIZE (gnu_result_type)) + || (TYPE_IS_PADDING_P (gnu_result_type) + && CONTAINS_PLACEHOLDER_P + (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_result_type)))))) op_code = INIT_EXPR; + else + op_code = MODIFY_EXPR; gnu_result = build_binary_op (op_code, NULL_TREE, gnu_target, gnu_result); |