summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-29 09:02:46 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-29 09:02:46 +0000
commit95164e7198c69e87adf63516993537c834b4512e (patch)
tree393bcdf9df2f8ceab15cb45aae341cbc2d86146c /gcc/ada/gcc-interface/utils2.c
parenta890896f9d530c1501c3e053174a8f4bcb1478e8 (diff)
* gcc-interface/ada-tree.h (DECL_RETURN_VALUE_P): New macro.
* gcc-interface/gigi.h (gigi): Remove useless attribute. (gnat_gimplify_expr): Likewise. (gnat_to_gnu_external): Declare. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Factor out code dealing with the expression of external constants into... Invoke gnat_to_gnu_external instead. <E_Variable>: Invoke gnat_to_gnu_external to translate renamed objects when not for a definition. Deal with COMPOUND_EXPR and variables with DECL_RETURN_VALUE_P set for renamings and with the case of a dangling 'reference to a function call in a renaming. Remove obsolete test and adjust associated comment. * gcc-interface/trans.c (Call_to_gnu): Set DECL_RETURN_VALUE_P on the temporaries created to hold the return value, if any. (gnat_to_gnu_external): ...this. New function. * gcc-interface/utils.c (create_var_decl): Detect a constant created to hold 'reference to function call. * gcc-interface/utils2.c (build_unary_op) <ADDR_EXPR>: Add folding for COMPOUND_EXPR in the DECL_RETURN_VALUE_P case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233804 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r--gcc/ada/gcc-interface/utils2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 44a05fb012d4..c1bb74da2874 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -1383,8 +1383,11 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
since the middle-end cannot handle it. But we don't it in the
general case because it may introduce aliasing issues if the
first operand is an indirect assignment and the second operand
- the corresponding address, e.g. for an allocator. */
- if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
+ the corresponding address, e.g. for an allocator. However do
+ it for a return value to expose it for later recognition. */
+ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE
+ || (TREE_CODE (TREE_OPERAND (operand, 1)) == VAR_DECL
+ && DECL_RETURN_VALUE_P (TREE_OPERAND (operand, 1))))
{
result = build_unary_op (ADDR_EXPR, result_type,
TREE_OPERAND (operand, 1));