From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 5D339384B072; Tue, 5 Jul 2022 08:30:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D339384B072 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1489] [Ada] Fix spurious error on object renaming with ghost type X-Act-Checkin: gcc X-Git-Author: Yannick Moy X-Git-Refname: refs/heads/master X-Git-Oldrev: dba077902daf195da0e5bbac33a1f34bc6b20367 X-Git-Newrev: 95e2844ef8fa68f7abd45646bae8b4362614bf9c Message-Id: <20220705083039.5D339384B072@sourceware.org> Date: Tue, 5 Jul 2022 08:30:39 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2022 08:30:39 -0000 https://gcc.gnu.org/g:95e2844ef8fa68f7abd45646bae8b4362614bf9c commit r13-1489-g95e2844ef8fa68f7abd45646bae8b4362614bf9c Author: Yannick Moy Date: Tue Jun 7 11:00:56 2022 +0200 [Ada] Fix spurious error on object renaming with ghost type Renaming of an object of ghost type leads to a spurious error. Now fixed. gcc/ada/ * ghost.adb (Is_OK_Ghost_Context): Detect ghost type inside object renaming. Diff: --- gcc/ada/ghost.adb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index 25b9a28fa01..8f23cbdedfe 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -508,7 +508,16 @@ package body Ghost is elsif Nkind (Parent (Par)) in N_Generic_Instantiation | N_Renaming_Declaration | N_Generic_Renaming_Declaration - and then Par = Name (Parent (Par)) + and then Par = Name (Parent (Par)) + then + return True; + + -- In the case of the renaming of a ghost object, the type + -- itself may be ghost. + + elsif Nkind (Parent (Par)) = N_Object_Renaming_Declaration + and then (Par = Subtype_Mark (Parent (Par)) + or else Par = Access_Definition (Parent (Par))) then return True;