+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
= 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);
}
+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.
--- /dev/null
+-- { dg-do compile }\r
+-- { dg-options "-gnatdm -gnatws" }\r
+\r
+with Discr6_Pkg;\r
+\r
+procedure Discr6 is\r
+\r
+ type T_Bit is range 0..1;\r
+ type T_Entier_16 is range -2**15 .. 2**15-1;\r
+\r
+ package My_Q is new Discr6_Pkg(T_Entier_16);\r
+\r
+ type T_Valeur is (BIT, Entier_16);\r
+\r
+ type R(D : T_Valeur) is record\r
+ case D is\r
+ when BIT => V_BIT : T_Bit;\r
+ when Entier_16 => V_E16 : T_Entier_16;\r
+ end case;\r
+ end record;\r
+ for R use record\r
+ V_BIT at 0 range 0..7;\r
+ V_E16 at 0 range 0..15;\r
+ D at 8 range 0..7;\r
+ end record;\r
+ for R'size use 128;\r
+\r
+ A : R(Entier_16);\r
+ I : Integer;\r
+\r
+begin\r
+ I := My_Q.X(A.V_E16);\r
+end;\r
--- /dev/null
+generic\r
+\r
+ type T(<>) is private;\r
+\r
+package Discr6_Pkg is\r
+\r
+ function X (A : T) return Integer;\r
+\r
+ pragma Interface(C, X);\r
+ pragma IMPORT_FUNCTION (\r
+ INTERNAL => X,\r
+ EXTERNAL => X,\r
+ PARAMETER_TYPES => (T),\r
+ MECHANISM => (Descriptor(S)));\r
+\r
+end Discr6_Pkg;\r