diff mbox series

[Ada] Fix ICE on instantiation on unconstrained array with predicate

Message ID 2890596.KvYaENWDyR@polaris
State New
Headers show
Series [Ada] Fix ICE on instantiation on unconstrained array with predicate | expand

Commit Message

Eric Botcazou Oct. 11, 2019, 8:33 a.m. UTC
This fixes an ICE on the instantiation of a generic package taking an 
unconstrained array type declared with a predicate as generic actual 
parameter.

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


2019-10-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (Gigi_Equivalent_Type) <E_Array_Subtype>: New
	case.  Return the base type if the subtype is not constrained.


2019-10-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/array38.adb: New test.
	* gnat.dg/array38_pkg.ad[sb]: New helper.
diff mbox series

Patch

Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 276864)
+++ gcc-interface/decl.c	(working copy)
@@ -5026,6 +5026,11 @@  Gigi_Equivalent_Type (Entity_Id gnat_ent
       gnat_equiv = Etype (gnat_entity);
       break;
 
+    case E_Array_Subtype:
+      if (!Is_Constrained (gnat_entity))
+	gnat_equiv = Etype (gnat_entity);
+      break;
+
     case E_Class_Wide_Type:
       gnat_equiv = Root_Type (gnat_entity);
       break;