From patchwork Fri Oct 11 08:33:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1175011 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510722-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="px8dcUiG"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46qLng6NYPz9sP3 for ; Fri, 11 Oct 2019 19:33:25 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=WBeTCDbIgUp74X8o rDa+Z3GiM8ewfBbsiDFSrK6L47U2Z6zGecEiU+Y9Z7JyUzhkj5k0OUbQGknFrOca k6etmUVM6g+VLUh20GMzKHaZaF+tTQyo49hNJYhtccQpKaYWXMnmHgxTWGGcZbkV ZEEa5mG6rf2TwreFS0Z8xpepw9c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=T3+7Wh9thhg6xM4UIbVtlp SBPVg=; b=px8dcUiGUS9Tq578155RUOLs7W5ZpMQFJ09Dotd1dzNtZCAQS6dB5g CPc4xLSroK/f+IAhaJzEz31CvW9v8rrZrtPZ8cB98k2h5yIPcnAqqAv+OlMWT8Z1 93r6OFXB4L2L3JBN215BYj5NG0P0Jzb3PGOmPmJeiy0imBeWIqUBA= Received: (qmail 120241 invoked by alias); 11 Oct 2019 08:33:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 120226 invoked by uid 89); 11 Oct 2019 08:33:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Oct 2019 08:33:16 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 903C181398 for ; Fri, 11 Oct 2019 10:33:14 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K-SY9PiSJXM2 for ; Fri, 11 Oct 2019 10:33:14 +0200 (CEST) Received: from polaris.localnet (unknown [IPv6:2a01:e35:8a16:3850:1a03:73ff:fe45:373a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 686618138C for ; Fri, 11 Oct 2019 10:33:14 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix ICE on instantiation on unconstrained array with predicate Date: Fri, 11 Oct 2019 10:33:12 +0200 Message-ID: <2890596.KvYaENWDyR@polaris> MIME-Version: 1.0 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 * gcc-interface/decl.c (Gigi_Equivalent_Type) : New case. Return the base type if the subtype is not constrained. 2019-10-11 Eric Botcazou * gnat.dg/array38.adb: New test. * gnat.dg/array38_pkg.ad[sb]: New helper. 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;