diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-06-09 09:41:16 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-06-09 09:41:16 +0000 |
commit | 912cb4420dab339e6f07bb8222c3ea75514a2583 (patch) | |
tree | cf96aab5ea1b9dabffded7ef9da2d17a1a7f95b0 /gcc | |
parent | 2c2b17103d38452f39a4a1297c6577e7d2b2f8d9 (diff) | |
download | gcc-912cb4420dab339e6f07bb8222c3ea75514a2583.zip gcc-912cb4420dab339e6f07bb8222c3ea75514a2583.tar.gz gcc-912cb4420dab339e6f07bb8222c3ea75514a2583.tar.bz2 |
decl.c (components_to_record): Adjust the packedness for the qualified union as well.
* decl.c (components_to_record): Adjust the packedness for the
qualified union as well.
From-SVN: r136583
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/decl.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/pack3.ads | 45 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/pack3_pkg.ads | 7 |
5 files changed, 69 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0fcead3..29a2071 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2008-06-09 Eric Botcazou <ebotcazou@adacore.com> + + * decl.c (components_to_record): Adjust the packedness for the + qualified union as well. + 2008-06-09 Arnaud Charlet <charlet@adacore.com> * Make-lang.in: Use -gnatwns instead of -gnatws to make sytyle diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 01827b4..b8bcb4b 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -6461,6 +6461,8 @@ components_to_record (tree gnu_record_type, Node_Id component_list, /* Only make the QUAL_UNION_TYPE if there are any non-empty variants. */ if (gnu_variant_list) { + int union_field_packed; + if (all_rep_and_size) { TYPE_SIZE (gnu_union_type) = TYPE_SIZE (gnu_record_type); @@ -6482,9 +6484,13 @@ components_to_record (tree gnu_record_type, Node_Id component_list, return; } + /* Deal with packedness like in gnat_to_gnu_field. */ + union_field_packed + = adjust_packed (gnu_union_type, gnu_record_type, packed); + gnu_union_field = create_field_decl (gnu_var_name, gnu_union_type, gnu_record_type, - packed, + union_field_packed, all_rep ? TYPE_SIZE (gnu_union_type) : 0, all_rep ? bitsize_zero_node : 0, 0); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ee3af09..4f7a586 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-06-09 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/pack3.ads: New test. + * gnat.dg/specs/pack3_pkg.ads: New helper. + 2008-06-08 Paolo Carlini <paolo.carlini@oracle.com> PR c++/35242 diff --git a/gcc/testsuite/gnat.dg/specs/pack3.ads b/gcc/testsuite/gnat.dg/specs/pack3.ads new file mode 100644 index 0000000..ba2b346 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/pack3.ads @@ -0,0 +1,45 @@ +-- { dg-do compile } + +with Pack3_Pkg; + +package Pack3 is + + subtype N_TYPE is INTEGER range 0..5; + + type LIST_ARRAY is array (N_TYPE range <>) of INTEGER; + + type LIST (N : N_TYPE := 0) is record + LIST : LIST_ARRAY(1..N); + end record; + pragma PACK(LIST); + + subtype CS is STRING(1..Pack3_Pkg.F); + + type CSA is array (NATURAL range <>) of CS; + + type REC is record + I1, I2 : INTEGER; + end record ; + + type CMD is (CO, AS); + + type CMD_BLOCK_TYPE (D : CMD := CO) is record + N : CSA (1..4); + case D is + when CO => L : LIST; + when AS => R : REC; + end case ; + end record; + pragma PACK(CMD_BLOCK_TYPE); + + type CMD_TYPE is (RIGHT, WRONG); + + type CMD_RESULT (D : CMD_TYPE) is record + case D is + when RIGHT => C : CMD_BLOCK_TYPE; + when WRONG => null; + end case; + end record ; + pragma PACK(CMD_RESULT); + +end Pack3; diff --git a/gcc/testsuite/gnat.dg/specs/pack3_pkg.ads b/gcc/testsuite/gnat.dg/specs/pack3_pkg.ads new file mode 100644 index 0000000..2003331 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/pack3_pkg.ads @@ -0,0 +1,7 @@ +-- { dg-excess-errors "no code generated" } + +package Pack3_Pkg is + + function F return Integer; + +end Pack3_Pkg; |