aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2013-03-06 18:00:50 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2013-03-06 18:00:50 +0000
commitafb0fadf9d4128d2e7f508535fc070beb161ffc2 (patch)
treed44c6d26309de6f76195111e553b5bb8f8f2f4e7
parent6f71e355ebcc5e6e3474369ea5dd361d3ee5875d (diff)
downloadgcc-afb0fadf9d4128d2e7f508535fc070beb161ffc2.zip
gcc-afb0fadf9d4128d2e7f508535fc070beb161ffc2.tar.gz
gcc-afb0fadf9d4128d2e7f508535fc070beb161ffc2.tar.bz2
decl.c (gnat_to_gnu_field): Remove the wrapper around a misaligned integral type if...
* gcc-interface/decl.c (gnat_to_gnu_field): Remove the wrapper around a misaligned integral type if a size is specified for the field. From-SVN: r196506
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/gcc-interface/decl.c7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gnat.dg/specs/aggr6.ads25
4 files changed, 43 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 9c6df96..4f0478a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,4 +1,9 @@
-2013-06-03 Eric Botcazou <ebotcazou@adacore.com>
+2013-03-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_field): Remove the wrapper around
+ a misaligned integral type if a size is specified for the field.
+
+2013-03-06 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Raise_Error_to_gnu) <CE_Index_Check_Failed>:
Record the unpadded type of the index type on the RCI stack.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 56b64a3..7342fa3 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -6619,6 +6619,13 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
<= 0)
gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type));
+ /* Similarly if the field's type is a misaligned integral type, but
+ there is no restriction on the size as there is no justification. */
+ if (!needs_strict_alignment
+ && TYPE_IS_PADDING_P (gnu_field_type)
+ && INTEGRAL_TYPE_P (TREE_TYPE (TYPE_FIELDS (gnu_field_type))))
+ gnu_field_type = TREE_TYPE (TYPE_FIELDS (gnu_field_type));
+
gnu_field_type
= make_type_from_size (gnu_field_type, gnu_size,
Has_Biased_Representation (gnat_field));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 393e5a4..824f5f9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,8 @@
-2013-06-03 Eric Botcazou <ebotcazou@adacore.com>
+2013-03-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/aggr6.ads: New test.
+
+2013-03-06 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/loop_optimization15.ad[sb]: New test.
diff --git a/gcc/testsuite/gnat.dg/specs/aggr6.ads b/gcc/testsuite/gnat.dg/specs/aggr6.ads
new file mode 100644
index 0000000..8144105
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/aggr6.ads
@@ -0,0 +1,25 @@
+-- { dg-do compile }
+
+package Aggr6 is
+
+ type B15_T is mod 2 ** 15;
+ for B15_T'Size use 15;
+ for B15_T'Alignment use 1;
+
+ type B17_T is mod 2 ** 17;
+ for B17_T'Size use 17;
+ for B17_T'Alignment use 1;
+
+ type Rec_T is record
+ A : B17_T;
+ B : B15_T;
+ end record;
+ for Rec_T use record
+ A at 0 range 0 .. 16;
+ B at 0 range 17 .. 31;
+ end record;
+ for Rec_T'Size use 32;
+
+ C : constant Rec_T := (A => 1, B => 0);
+
+end Aggr6;