aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-03-07 18:41:01 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2008-03-07 18:41:01 +0000
commitb49a1a1e0fef509deb7d91ef348ad3793478f471 (patch)
tree01383e32c69120abe8445d35e65f328e6c8bdf0a /gcc/ada
parent38516a1ab66ecdd05a12bfaad2eb05736a36e1c0 (diff)
downloadgcc-b49a1a1e0fef509deb7d91ef348ad3793478f471.zip
gcc-b49a1a1e0fef509deb7d91ef348ad3793478f471.tar.gz
gcc-b49a1a1e0fef509deb7d91ef348ad3793478f471.tar.bz2
decl.c (gnat_to_gnu_entity): Add comment for the packed array type case.
* decl.c (gnat_to_gnu_entity) <E_Modular_Integer_Subtype>: Add comment for the packed array type case. * utils.c (build_template): Use a loop to strip padding or containing records for justified modular types. From-SVN: r133014
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/decl.c5
-rw-r--r--gcc/ada/utils.c6
3 files changed, 15 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 9d92d7b..5632ddf 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,12 @@
2008-03-07 Eric Botcazou <ebotcazou@adacore.com>
+ * decl.c (gnat_to_gnu_entity) <E_Modular_Integer_Subtype>: Add
+ comment for the packed array type case.
+ * utils.c (build_template): Use a loop to strip padding or
+ containing records for justified modular types.
+
+2008-03-07 Eric Botcazou <ebotcazou@adacore.com>
+
* decl.c (gnat_to_gnu_entity): Issue a warning on suspiciously
large alignments specified for types.
(validate_alignment): Minor cleanup.
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index 4827939..c1d02ec 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -1493,6 +1493,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
= UI_To_gnu (RM_Size (gnat_entity), bitsizetype);
gnu_type = make_node (RECORD_TYPE);
TYPE_NAME (gnu_type) = create_concat_name (gnat_entity, "JM");
+
+ /* Propagate the alignment of the modular type to the record.
+ This means that bitpacked arrays have "ceil" alignment for
+ their size, which may seem counter-intuitive but makes it
+ possible to easily overlay them on modular types. */
TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_field_type);
TYPE_USER_ALIGN (gnu_type) = TYPE_USER_ALIGN (gnu_field_type);
TYPE_PACKED (gnu_type) = 1;
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index bdce72a..46ce865 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -2486,9 +2486,9 @@ build_template (tree template_type, tree array_type, tree expr)
tree bound_list = NULL_TREE;
tree field;
- if (TREE_CODE (array_type) == RECORD_TYPE
- && (TYPE_IS_PADDING_P (array_type)
- || TYPE_JUSTIFIED_MODULAR_P (array_type)))
+ while (TREE_CODE (array_type) == RECORD_TYPE
+ && (TYPE_IS_PADDING_P (array_type)
+ || TYPE_JUSTIFIED_MODULAR_P (array_type)))
array_type = TREE_TYPE (TYPE_FIELDS (array_type));
if (TREE_CODE (array_type) == ARRAY_TYPE