Patchwork [Ada] Fix orphaned DIE for access type to record type

login
register
mail settings
Submitter Eric Botcazou
Date April 2, 2011, 9:20 a.m.
Message ID <201104021120.01051.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/89443/
State New
Headers show

Comments

Eric Botcazou - April 2, 2011, 9:20 a.m.
This fixes the fallouts of the previous series of patches.

Tested on i586-suse-linux, applied on the mainline.


2011-04-02  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/utils.c (update_pointer_to): Finalize named pointer
	types.


2011-04-02  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/debug2.ad[sb]: New test.
	* gnat.dg/debug2_pkg.ads: New helper.
	* gnat.dg/debug3.ad[sb]: New test.

Patch

Index: gcc-interface/utils.c
===================================================================
--- gcc-interface/utils.c	(revision 171885)
+++ gcc-interface/utils.c	(working copy)
@@ -3559,7 +3559,12 @@  update_pointer_to (tree old_type, tree n
       for (; ptr; ptr = TYPE_NEXT_PTR_TO (ptr))
 	for (t = TYPE_MAIN_VARIANT (ptr); t; t = TYPE_NEXT_VARIANT (t))
 	  TREE_TYPE (t) = new_type;
-      TYPE_POINTER_TO (old_type) = NULL_TREE;
+
+      /* If we have adjusted named types, finalize them.  This is necessary
+	 since we had forced a DWARF typedef for them in gnat_pushdecl.  */
+      for (ptr = TYPE_POINTER_TO (old_type); ptr; ptr = TYPE_NEXT_PTR_TO (ptr))
+	if (TYPE_NAME (ptr) && TREE_CODE (TYPE_NAME (ptr)) == TYPE_DECL)
+	  rest_of_type_decl_compilation (TYPE_NAME (ptr));
 
       /* Chain REF and its variants at the end.  */
       new_ref = TYPE_REFERENCE_TO (new_type);
@@ -3576,6 +3581,8 @@  update_pointer_to (tree old_type, tree n
       for (; ref; ref = TYPE_NEXT_REF_TO (ref))
 	for (t = TYPE_MAIN_VARIANT (ref); t; t = TYPE_NEXT_VARIANT (t))
 	  TREE_TYPE (t) = new_type;
+
+      TYPE_POINTER_TO (old_type) = NULL_TREE;
       TYPE_REFERENCE_TO (old_type) = NULL_TREE;
     }