diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-04-20 10:32:55 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-04-20 10:32:55 +0000 |
commit | e871a8730ae8bd2a50a47a6c87691078e2e7fff6 (patch) | |
tree | ea175801501f23572184c58df3fcd73cad6a8ea7 /gcc/ada/utils2.c | |
parent | def9bf340183a00cbc648eaddf24ed2d3baf32b4 (diff) | |
download | gcc-e871a8730ae8bd2a50a47a6c87691078e2e7fff6.zip gcc-e871a8730ae8bd2a50a47a6c87691078e2e7fff6.tar.gz gcc-e871a8730ae8bd2a50a47a6c87691078e2e7fff6.tar.bz2 |
decl.c (gnat_to_gnu_entity): Also promote the alignment of constant objects, but not exceptions.
* decl.c (gnat_to_gnu_entity) <object>: 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) <MODIFY_EXPR>: Also use the padded view of
the type when copying to padded object and the source is a constructor.
From-SVN: r134483
Diffstat (limited to 'gcc/ada/utils2.c')
-rw-r--r-- | gcc/ada/utils2.c | 15 |
1 files changed, 9 insertions, 6 deletions
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. */ |