From e871a8730ae8bd2a50a47a6c87691078e2e7fff6 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 20 Apr 2008 10:32:55 +0000 Subject: decl.c (gnat_to_gnu_entity): Also promote the alignment of constant objects, but not exceptions. * decl.c (gnat_to_gnu_entity) : Also promote the alignment of constant objects, but not exceptions. * trans.c (add_decl_expr): Use gnat_types_compatible_p for type compatibility test. * utils.c (create_var_decl_1): Likewise. * utils2.c (build_binary_op) : Also use the padded view of the type when copying to padded object and the source is a constructor. From-SVN: r134483 --- gcc/ada/utils2.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'gcc/ada/utils2.c') diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index 5888bc5..877959d 100644 --- a/gcc/ada/utils2.c +++ b/gcc/ada/utils2.c @@ -695,16 +695,19 @@ build_binary_op (enum tree_code op_code, tree result_type, /* If we are copying between padded objects of the same underlying type with a non-zero size, use the padded view of the type, this - is very likely more efficient. */ + is very likely more efficient; but gnat_to_gnu will have removed + the padding on the RHS so we have to make sure that we can safely + put it back. */ else if (TREE_CODE (left_type) == RECORD_TYPE && TYPE_IS_PADDING_P (left_type) && TREE_TYPE (TYPE_FIELDS (left_type)) == right_type && !integer_zerop (TYPE_SIZE (right_type)) - && TREE_CODE (right_operand) == COMPONENT_REF - && TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0))) - == RECORD_TYPE - && TYPE_IS_PADDING_P - (TREE_TYPE (TREE_OPERAND (right_operand, 0)))) + && ((TREE_CODE (right_operand) == COMPONENT_REF + && TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0))) + == RECORD_TYPE + && TYPE_IS_PADDING_P + (TREE_TYPE (TREE_OPERAND (right_operand, 0)))) + || TREE_CODE (right_operand) == CONSTRUCTOR)) operation_type = left_type; /* Find the best type to use for copying between aggregate types. */ -- cgit v1.1