From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id B4A353858404; Tue, 26 Sep 2023 15:33:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4A353858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695742412; bh=iwZ5w38vXUXqc1d9YcFv1R5yIZ1ehQqwjIh/5ma5VYk=; h=From:To:Subject:Date:From; b=xQ92faJdX7v4v0nDagcRJ/JAHTLHDcLXrQpYOtBrSoTxU5qp68weu/N7/bT8xhBqF 7Pyx1QfaJ4+GS6PAjSSYOZTwYd4zirMswsLpHPDRuZT/Xo+CcfMFUda1qZI2q91gTw 0A7yNfMnM0yQdDazUlGWfiXX4o6P0bNcQqRMjAhs= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-7840] ada: Fix deferred constant wrongly rejected X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 5a5e1be3ddacc6c74c1f13a3dba4dab2dcba11e3 X-Git-Newrev: 35787c3093fa611ba46008e94f329000d6042be4 Message-Id: <20230926153332.B4A353858404@sourceware.org> Date: Tue, 26 Sep 2023 15:33:32 +0000 (GMT) List-Id: https://gcc.gnu.org/g:35787c3093fa611ba46008e94f329000d6042be4 commit r13-7840-g35787c3093fa611ba46008e94f329000d6042be4 Author: Eric Botcazou Date: Sat Sep 16 20:29:20 2023 +0200 ada: Fix deferred constant wrongly rejected This recent regression occurs when the nominal subtype of the constant is a discriminated record type with default discriminants. gcc/ada/ PR ada/110488 * sem_ch3.adb (Analyze_Object_Declaration): Do not build a default subtype for a deferred constant in the definite case too. Diff: --- gcc/ada/sem_ch3.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 299ea6e989f..7aa13b86607 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4956,9 +4956,11 @@ package body Sem_Ch3 is Apply_Length_Check (E, T); end if; - -- When possible, build the default subtype + -- When possible, and not a deferred constant, build the default subtype - elsif Build_Default_Subtype_OK (T) then + elsif Build_Default_Subtype_OK (T) + and then (not Constant_Present (N) or else Present (E)) + then if No (E) then Act_T := Build_Default_Subtype (T, N); else