aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/utils2.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2007-09-22 13:04:20 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2007-09-22 13:04:20 +0000
commitb235734c763af862a2606225d7aefd9990847edd (patch)
treecdaa6a05a038be356ee679bf041bd00b883cd7fa /gcc/ada/utils2.c
parente1210bd06b7a46f5878e822ee93c06e073aaff33 (diff)
downloadgcc-b235734c763af862a2606225d7aefd9990847edd.zip
gcc-b235734c763af862a2606225d7aefd9990847edd.tar.gz
gcc-b235734c763af862a2606225d7aefd9990847edd.tar.bz2
utils2.c (build_unary_op): Propagate the TYPE_REF_CAN_ALIAS_ALL flag to the result.
* utils2.c (build_unary_op) <ADDR_EXPR> [INDIRECT_REF]: Propagate the TYPE_REF_CAN_ALIAS_ALL flag to the result. From-SVN: r128669
Diffstat (limited to 'gcc/ada/utils2.c')
-rw-r--r--gcc/ada/utils2.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index a895459..350358f 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -1078,6 +1078,25 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
GCC wants pointer types for function addresses. */
if (!result_type)
result_type = build_pointer_type (type);
+
+ /* If the underlying object can alias everything, propagate the
+ property since we are effectively retrieving the object. */
+ if (POINTER_TYPE_P (TREE_TYPE (result))
+ && TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (result)))
+ {
+ if (TREE_CODE (result_type) == POINTER_TYPE
+ && !TYPE_REF_CAN_ALIAS_ALL (result_type))
+ result_type
+ = build_pointer_type_for_mode (TREE_TYPE (result_type),
+ TYPE_MODE (result_type),
+ true);
+ else if (TREE_CODE (result_type) == REFERENCE_TYPE
+ && !TYPE_REF_CAN_ALIAS_ALL (result_type))
+ result_type
+ = build_reference_type_for_mode (TREE_TYPE (result_type),
+ TYPE_MODE (result_type),
+ true);
+ }
break;
case NULL_EXPR: