diff mbox series

Fix PR ada/62235

Message ID 6220290.NY0sf8PeYM@polaris
State New
Headers show
Series Fix PR ada/62235 | expand

Commit Message

Eric Botcazou Sept. 5, 2017, 9:49 a.m. UTC
Tested on x86_64-suse-linux, applied on mainline and 7 branch.


2017-09-05  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/62235
	* gcc-interface/decl.c (gnat_to_gnu_entity): Skip regular processing
	for Itypes that are E_Record_Subtype with a cloned subtype.
	<E_Record_Subtype>: Use the DECL of the cloned type directly, if any.


2017-09-05  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/incomplete5.ad[sb]: New test.
	* gnat.dg/incomplete5_pkg.ad[sb]: New helper.
diff mbox series

Patch

Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 251700)
+++ gcc-interface/decl.c	(working copy)
@@ -312,11 +312,14 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 
   /* Since a use of an Itype is a definition, process it as such if it is in
      the main unit, except for E_Access_Subtype because it's actually a use
-     of its base type, see below.  */
+     of its base type, and for E_Record_Subtype with cloned subtype because
+     it's actually a use of the cloned subtype, see below.  */
   if (!definition
       && is_type
       && Is_Itype (gnat_entity)
-      && Ekind (gnat_entity) != E_Access_Subtype
+      && !(kind == E_Access_Subtype
+	   || (kind == E_Record_Subtype
+	       && Present (Cloned_Subtype (gnat_entity))))
       && !present_gnu_tree (gnat_entity)
       && In_Extended_Main_Code_Unit (gnat_entity))
     {
@@ -3411,7 +3414,7 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 	{
 	  gnu_decl = gnat_to_gnu_entity (Cloned_Subtype (gnat_entity),
 					 NULL_TREE, false);
-	  maybe_present = true;
+	  saved = true;
 	  break;
 	}