From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 3953A3858C39; Thu, 5 Jan 2023 14:38:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3953A3858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672929500; bh=pVxY8+Fz3lT22XIrcz63ZepQyBu4YRYFE6h3vaif8cc=; h=From:To:Subject:Date:From; b=yaEL+SHpF8Z6QlN49+z1w5sdg5CjgeE++hMnzyBBMqjZ3a+pYKpB/jh5SQjHSO1o8 iI98XldogjWDOXJFiljlVBNHivSI/8FHpEKDbZ/q7HZ9fu55CM1quGmkfz9G8kPy+v YwgAtrhJGpqonl/YYxDEVwyG7sxcdio7ObHJIKoE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5015] ada: Spurious error on Lock_Free protected type with discriminants X-Act-Checkin: gcc X-Git-Author: Justin Squirek X-Git-Refname: refs/heads/master X-Git-Oldrev: 8313c5f600fe935d00b4ff52539e01df67af928d X-Git-Newrev: 2aa5f94243c5d463cc62a3c91ebf87fb1c665b83 Message-Id: <20230105143820.3953A3858C39@sourceware.org> Date: Thu, 5 Jan 2023 14:38:20 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2aa5f94243c5d463cc62a3c91ebf87fb1c665b83 commit r13-5015-g2aa5f94243c5d463cc62a3c91ebf87fb1c665b83 Author: Justin Squirek Date: Mon Dec 5 22:05:44 2022 +0000 ada: Spurious error on Lock_Free protected type with discriminants This patch corrects an issue in the compiler whereby unprefixed discriminants appearing in protected subprograms were unable to be properly resolved - leading to spurious resolution errors. gcc/ada/ * sem_ch8.adb (Set_Entity_Or_Discriminal): Verify we are actually resetting the entity field of a non-prefixed discriminant reference. Diff: --- gcc/ada/sem_ch8.adb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 841076bbd01..fe89e1127ee 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -4891,14 +4891,16 @@ package body Sem_Ch8 is then null; - -- Don't replace the discriminant in strict preanalysis mode since - -- it can lead to errors during full analysis when the discriminant - -- gets referenced later. + -- Don't replace a non-qualified discriminant in strict preanalysis + -- mode since it can lead to errors during full analysis when the + -- discriminant gets referenced later. -- This can occur in situations where a protected type contains - -- an expression function which references a discriminant. + -- an expression function which references a non-prefixed + -- discriminant. - elsif Preanalysis_Active + elsif No (P) + and then Preanalysis_Active and then Inside_Preanalysis_Without_Freezing = 0 then null;