diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-05-03 19:47:22 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-05-03 19:47:22 +0000 |
commit | 8f85525e4102574486728caf5e5aa3d91ab101e1 (patch) | |
tree | edbdf6ee7b678c7d7daf005d8787b89e016bcbcf | |
parent | 88f36b7eb6a153a914e9b4d678c1ddaddb842747 (diff) | |
download | gcc-8f85525e4102574486728caf5e5aa3d91ab101e1.zip gcc-8f85525e4102574486728caf5e5aa3d91ab101e1.tar.gz gcc-8f85525e4102574486728caf5e5aa3d91ab101e1.tar.bz2 |
decl.c (components_to_record): Zero the alignment of the qualified union built for the variant part upon...
* decl.c (components_to_record): Zero the alignment of the qualified
union built for the variant part upon creating it.
From-SVN: r134917
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/decl.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/discr6.adb | 33 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/discr6_pkg.ads | 16 |
5 files changed, 60 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6da64b6..28cf5dc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2008-05-03 Eric Botcazou <ebotcazou@adacore.com> + * decl.c (components_to_record): Zero the alignment of the qualified + union built for the variant part upon creating it. + +2008-05-03 Eric Botcazou <ebotcazou@adacore.com> + * decl.c (maybe_pad_type): Try to get a form of the type with integral mode even if the alignment is not a factor of the original size. But make sure to create the inner field with the original size. Reorder. diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 9d933b7..68ea42b 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -6322,6 +6322,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, = make_node (unchecked_union ? UNION_TYPE : QUAL_UNION_TYPE); TYPE_NAME (gnu_union_type) = gnu_union_name; + TYPE_ALIGN (gnu_union_type) = 0; TYPE_PACKED (gnu_union_type) = TYPE_PACKED (gnu_record_type); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 53a4fc0..a8880ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2008-05-03 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/discr6_pkg.ads: New helper. + * gnat.dg/discr6.adb: New test. + +2008-05-03 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/alignment4.adb: Adjust. * gnat.dg/alignment5.adb: Likewise. * gnat.dg/alignment6.adb: XFAIL. diff --git a/gcc/testsuite/gnat.dg/discr6.adb b/gcc/testsuite/gnat.dg/discr6.adb new file mode 100644 index 0000000..441b19b --- /dev/null +++ b/gcc/testsuite/gnat.dg/discr6.adb @@ -0,0 +1,33 @@ +-- { dg-do compile }
+-- { dg-options "-gnatdm -gnatws" }
+
+with Discr6_Pkg;
+
+procedure Discr6 is
+
+ type T_Bit is range 0..1;
+ type T_Entier_16 is range -2**15 .. 2**15-1;
+
+ package My_Q is new Discr6_Pkg(T_Entier_16);
+
+ type T_Valeur is (BIT, Entier_16);
+
+ type R(D : T_Valeur) is record
+ case D is
+ when BIT => V_BIT : T_Bit;
+ when Entier_16 => V_E16 : T_Entier_16;
+ end case;
+ end record;
+ for R use record
+ V_BIT at 0 range 0..7;
+ V_E16 at 0 range 0..15;
+ D at 8 range 0..7;
+ end record;
+ for R'size use 128;
+
+ A : R(Entier_16);
+ I : Integer;
+
+begin
+ I := My_Q.X(A.V_E16);
+end;
diff --git a/gcc/testsuite/gnat.dg/discr6_pkg.ads b/gcc/testsuite/gnat.dg/discr6_pkg.ads new file mode 100644 index 0000000..11d713c --- /dev/null +++ b/gcc/testsuite/gnat.dg/discr6_pkg.ads @@ -0,0 +1,16 @@ +generic
+
+ type T(<>) is private;
+
+package Discr6_Pkg is
+
+ function X (A : T) return Integer;
+
+ pragma Interface(C, X);
+ pragma IMPORT_FUNCTION (
+ INTERNAL => X,
+ EXTERNAL => X,
+ PARAMETER_TYPES => (T),
+ MECHANISM => (Descriptor(S)));
+
+end Discr6_Pkg;
|