aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-03-24 16:08:50 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-03-24 16:08:50 +0000
commite3c4580e400367dfceec3e4c0539b43fcb4ed340 (patch)
treeb9005d8dcb786199a152d4e3d91717ba40010452 /gcc/ada/gcc-interface/utils2.c
parentcf4a36dfe1135dce070ac1d5a570e00a3eaac0be (diff)
downloadgcc-e3c4580e400367dfceec3e4c0539b43fcb4ed340.zip
gcc-e3c4580e400367dfceec3e4c0539b43fcb4ed340.tar.gz
gcc-e3c4580e400367dfceec3e4c0539b43fcb4ed340.tar.bz2
einfo.ads (Size_Depends_On_Discriminant): Adjust description.
* einfo.ads (Size_Depends_On_Discriminant): Adjust description. * layout.adb (Compute_Size_Depends_On_Discriminant): New procedure to compute Set_Size_Depends_On_Discriminant. (Layout_Type): Call it on array types in back-end layout mode. * sem_util.adb (Requires_Transient_Scope): Return true for array types only if the size depends on the value of discriminants. * gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Use the RHS type if the RHS is a call to a function that returns an unconstrained type with default discriminant. From-SVN: r171402
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r--gcc/ada/gcc-interface/utils2.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 07d6b5b..78f5fd9 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -186,7 +186,7 @@ known_alignment (tree exp)
static tree
find_common_type (tree t1, tree t2)
{
- /* ??? As of today, various constructs lead here with types of different
+ /* ??? As of today, various constructs lead to here with types of different
sizes even when both constants (e.g. tagged types, packable vs regular
component types, padded vs unpadded types, ...). While some of these
would better be handled upstream (types should be made consistent before
@@ -609,6 +609,15 @@ build_binary_op (enum tree_code op_code, tree result_type,
&& !integer_zerop (TYPE_SIZE (right_type)))
operation_type = left_type;
+ /* If we have a call to a function that returns an unconstrained type
+ with default discriminant on the RHS, use the RHS type (which is
+ padded) as we cannot compute the size of the actual assignment. */
+ else if (TREE_CODE (right_operand) == CALL_EXPR
+ && TYPE_IS_PADDING_P (right_type)
+ && CONTAINS_PLACEHOLDER_P
+ (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (right_type)))))
+ operation_type = right_type;
+
/* Find the best type to use for copying between aggregate types. */
else if (((TREE_CODE (left_type) == ARRAY_TYPE
&& TREE_CODE (right_type) == ARRAY_TYPE)