aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-04-20 10:32:55 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2008-04-20 10:32:55 +0000
commite871a8730ae8bd2a50a47a6c87691078e2e7fff6 (patch)
treeea175801501f23572184c58df3fcd73cad6a8ea7 /gcc/ada/decl.c
parentdef9bf340183a00cbc648eaddf24ed2d3baf32b4 (diff)
downloadgcc-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/decl.c')
-rw-r--r--gcc/ada/decl.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index 9d4412d..e60b443 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -673,18 +673,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& !Present (Address_Clause (gnat_entity)))
gnu_size = bitsize_unit_node;
- /* If this is an object with no specified size and alignment, and if
- either it is atomic or we are not optimizing alignment for space
- and it is a non-scalar variable, and the size of its type is a
- constant, set the alignment to the smallest not less than the
- size, or to the biggest meaningful one, whichever is smaller. */
+ /* If this is an object with no specified size and alignment, and
+ if either it is atomic or we are not optimizing alignment for
+ space and it is composite and not an exception, an Out parameter
+ or a reference to another object, and the size of its type is a
+ constant, set the alignment to the smallest one which is not
+ smaller than the size, with an appropriate cap. */
if (!gnu_size && align == 0
&& (Is_Atomic (gnat_entity)
|| (!Optimize_Alignment_Space (gnat_entity)
- && kind == E_Variable
- && AGGREGATE_TYPE_P (gnu_type)
- && !const_flag && No (Renamed_Object (gnat_entity))
- && !imported_p && No (Address_Clause (gnat_entity))))
+ && kind != E_Exception
+ && kind != E_Out_Parameter
+ && Is_Composite_Type (Etype (gnat_entity))
+ && !imported_p
+ && No (Renamed_Object (gnat_entity))
+ && No (Address_Clause (gnat_entity))))
&& TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST)
{
/* No point in jumping through all the hoops needed in order