diff mbox

[Ada] Fix ICE on instantiated packed array type

Message ID 2468786.2J6AOikYqt@polaris
State New
Headers show

Commit Message

Eric Botcazou Oct. 27, 2014, 11:14 a.m. UTC
This fixes an assertion failure in relate_alias_sets on an instantiated packed 
array type, because of a missing test before invoking the function.

Tested on x86_64-suse-linux, applied on mainline.


2014-10-27  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (gnat_to_gnu_entity): Apply special treatment
	of derived packed array types to constrained subtypes only.


2014-10-27  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/specs/pack10.ads: New test.
	* gnat.dg/specs/pack10_pkg.ad[sb]: New helper.
diff mbox

Patch

Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 216725)
+++ gcc-interface/decl.c	(working copy)
@@ -5083,8 +5083,10 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
       if (Is_Derived_Type (gnat_entity) && !type_annotate_only)
 	{
 	  Entity_Id gnat_parent_type = Underlying_Type (Etype (gnat_entity));
-	  /* For packed array subtypes, the implementation type is used.  */
+	  /* For constrained packed array subtypes, the implementation type is
+	     used instead of the nominal type.  */
 	  if (kind == E_Array_Subtype
+	      && Is_Constrained (gnat_entity)
 	      && Present (Packed_Array_Impl_Type (gnat_parent_type)))
 	    gnat_parent_type = Packed_Array_Impl_Type (gnat_parent_type);
 	  relate_alias_sets (gnu_type, gnat_to_gnu_type (gnat_parent_type),