This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Small tweak to renaming code


The code was testing Is_Composite_Type on the naked Etype, which doesn't 
really work if the type is private.

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


2009-04-07  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Test the
	underlying type.
	* gcc-interface/trans.c (lvalue_required_p): Likewise.


-- 
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 145660)
+++ gcc-interface/decl.c	(working copy)
@@ -886,7 +886,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 		/* Case 3: If this is a constant renaming and creating a
 		   new object is allowed and cheap, treat it as a normal
 		   object whose initial value is what is being renamed.  */
-		if (const_flag && Is_Elementary_Type (Etype (gnat_entity)))
+		if (const_flag
+		    && !Is_Composite_Type
+		        (Underlying_Type (Etype (gnat_entity))))
 		  ;
 
 		/* Case 4: Make this into a constant pointer to the object we
Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 145662)
+++ gcc-interface/trans.c	(working copy)
@@ -730,7 +730,8 @@ lvalue_required_p (Node_Id gnat_node, tr
 	 attached to the CONST_DECL.  */
       return (aliased != 0
 	      /* This should match the constant case of the renaming code.  */
-	      || Is_Composite_Type (Etype (Name (gnat_parent)))
+	      || Is_Composite_Type
+		 (Underlying_Type (Etype (Name (gnat_parent))))
 	      || Nkind (Name (gnat_parent)) == N_Identifier);
 
     default:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]