aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2017-09-05 08:28:20 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-09-05 08:28:20 +0000
commit6a9db54cc1e778e99998591920471a1e2eb5d7e1 (patch)
tree0c347b326ecd71cb92e68581ac2e3184f131b3dc /gcc
parenta0f8cad6254428d0f9b95f7328aa0c20207aa5a9 (diff)
downloadgcc-6a9db54cc1e778e99998591920471a1e2eb5d7e1.zip
gcc-6a9db54cc1e778e99998591920471a1e2eb5d7e1.tar.gz
gcc-6a9db54cc1e778e99998591920471a1e2eb5d7e1.tar.bz2
trans.c (Call_to_gnu): If this is a function call and there is no target...
* gcc-interface/trans.c (Call_to_gnu): If this is a function call and there is no target, do not create a temporary for the return value for an allocator either. From-SVN: r251695
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/gcc-interface/trans.c12
2 files changed, 13 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 32030b5..9250acf 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,11 @@
2017-09-05 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/trans.c (Call_to_gnu): If this is a function call and
+ there is no target, do not create a temporary for the return value for
+ an allocator either.
+
+2017-09-05 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/trans.c (pos_to_constructor): Skip conversions to an
unconstrained array type.
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index f7b51bb..eb77703 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -4338,11 +4338,11 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
parameters.
2. There is no target and the call is made for neither an object nor a
- renaming declaration, nor a return statement, and the return type has
- variable size, because in this case the gimplifier cannot create the
- temporary, or more generally is simply an aggregate type, because the
- gimplifier would create the temporary in the outermost scope instead
- of locally.
+ renaming declaration, nor a return statement, nor an allocator, and
+ the return type has variable size because in this case the gimplifier
+ cannot create the temporary, or more generally is simply an aggregate
+ type, because the gimplifier would then create the temporary in the
+ outermost scope instead of locally.
3. There is a target and it is a slice or an array with fixed size,
and the return type has variable size, because the gimplifier
@@ -4361,6 +4361,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
&& Nkind (Parent (gnat_node)) != N_Object_Declaration
&& Nkind (Parent (gnat_node)) != N_Object_Renaming_Declaration
&& Nkind (Parent (gnat_node)) != N_Simple_Return_Statement
+ && !(Nkind (Parent (gnat_node)) == N_Qualified_Expression
+ && Nkind (Parent (Parent (gnat_node))) == N_Allocator)
&& AGGREGATE_TYPE_P (gnu_result_type)
&& !TYPE_IS_FAT_POINTER_P (gnu_result_type))
|| (gnu_target