diff mbox

[Ada] Fix ICE on instantiation of packed array element

Message ID 51548343.UWF2luzvAI@polaris
State New
Headers show

Commit Message

Eric Botcazou May 15, 2017, 8:59 a.m. UTC
Tested on x86_64-suse-linux, applied on the mainline.


2017-05-15  Pierre-Marie de Rodat  <derodat@adacore.com>

	* gcc-interface/utils.c (can_materialize_object_renaming_p):
	Synchronize with GNAT's Exp_Dbug.Debug_Renaming_Declaration:
	process Original_Node instead of expanded names.


2017-05-15  Pierre-Marie de Rodat  <derodat@adacore.com>

	* gnat.dg/specs/pack13.ads: New test.
diff mbox

Patch

Index: gcc-interface/utils.c
===================================================================
--- gcc-interface/utils.c	(revision 248051)
+++ gcc-interface/utils.c	(working copy)
@@ -5431,11 +5431,16 @@  can_materialize_object_renaming_p (Node_
 {
   while (true)
     {
+      expr = Original_Node (expr);
+
       switch Nkind (expr)
 	{
 	case N_Identifier:
 	case N_Expanded_Name:
-	  return true;
+	  if (!Present (Renamed_Object (Entity (expr))))
+	    return true;
+	  expr = Renamed_Object (Entity (expr));
+	  break;
 
 	case N_Selected_Component:
 	  {