summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-13 18:40:26 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-13 18:40:26 +0000
commit9f31d8d2f80d7eef096e41e26cdeaf710166fbf9 (patch)
tree1209ab556421fad1e3fc3a74d1d777793febdb43
parent60c838997480840fbb2304cbd5155f20d84f036a (diff)
downloadppe42-gcc-9f31d8d2f80d7eef096e41e26cdeaf710166fbf9.tar.gz
ppe42-gcc-9f31d8d2f80d7eef096e41e26cdeaf710166fbf9.zip
PR ada/28591
* decl.c (components_to_record): Defer emitting debug info for the record type associated with the variant until after we are sure to actually use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116928 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/decl.c17
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/specs/unchecked_union.ads20
4 files changed, 41 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index fd8318b73f1..60fbf113820 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,12 @@
2006-09-13 Eric Botcazou <ebotcazou@adacore.com>
+ PR ada/28591
+ * decl.c (components_to_record): Defer emitting debug info for the
+ record type associated with the variant until after we are sure to
+ actually use it.
+
+2006-09-13 Eric Botcazou <ebotcazou@adacore.com>
+
PR ada/21952
* gigi.h (gnat_internal_attribute_table): Declare.
* misc.c (LANG_HOOKS_ATTRIBUTE_TABLE): Define to above.
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index 6a8f23424c5..6d70a159f3d 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -5659,10 +5659,12 @@ components_to_record (tree gnu_record_type, Node_Id component_list,
= TYPE_SIZE_UNIT (gnu_record_type);
}
+ /* Create the record for the variant. Note that we defer emitting
+ debug info for it until after we are sure to actually use it. */
components_to_record (gnu_variant_type, Component_List (variant),
NULL_TREE, packed, definition,
&gnu_our_rep_list, !all_rep_and_size, all_rep,
- false, unchecked_union);
+ true, unchecked_union);
gnu_qual = choices_to_gnu (gnu_discriminant,
Discrete_Choices (variant));
@@ -5676,6 +5678,13 @@ components_to_record (tree gnu_record_type, Node_Id component_list,
gnu_field = TYPE_FIELDS (gnu_variant_type);
else
{
+ /* Emit debug info for the record. We used to throw away
+ empty records but we no longer do that because we need
+ them to generate complete debug info for the variant;
+ otherwise, the union type definition will be lacking
+ the fields associated with these empty variants. */
+ write_record_type_debug_info (gnu_variant_type);
+
gnu_field = create_field_decl (gnu_inner_name, gnu_variant_type,
gnu_union_type, 0,
(all_rep_and_size
@@ -5695,12 +5704,6 @@ components_to_record (tree gnu_record_type, Node_Id component_list,
gnu_variant_list = gnu_field;
}
- /* We used to delete the empty variants from the end. However,
- we no longer do that because we need them to generate complete
- debugging information for the variant record. Otherwise,
- the union type definition will be missing the fields associated
- to these empty variants. */
-
/* Only make the QUAL_UNION_TYPE if there are any non-empty variants. */
if (gnu_variant_list)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f9de5f24209..ae45deee404 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2006-09-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/unchecked_union.ads: New test.
+
2006-09-13 Richard Sandiford <richard@codesourcery.com>
PR rtl-optimization/28982
diff --git a/gcc/testsuite/gnat.dg/specs/unchecked_union.ads b/gcc/testsuite/gnat.dg/specs/unchecked_union.ads
new file mode 100644
index 00000000000..260f781d89d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/unchecked_union.ads
@@ -0,0 +1,20 @@
+-- PR ada/28591
+-- Reported by Martin Michlmayr <tbm@cyrius.com>
+
+-- { dg-do compile }
+-- { dg-options "-g" }
+
+with Interfaces; use Interfaces;
+
+package Unchecked_Union is
+ type Mode_Type is (Mode_B2);
+
+ type Value_Union (Mode : Mode_Type := Mode_B2) is record
+ case Mode is
+ when Mode_B2 =>
+ B2 : Integer_32;
+ end case;
+ end record;
+ pragma Unchecked_Union (Value_Union);
+
+end Unchecked_Union;
OpenPOWER on IntegriCloud