public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1489] [Ada] Fix spurious error on object renaming with ghost type
Date: Tue,  5 Jul 2022 08:30:39 +0000 (GMT)	[thread overview]
Message-ID: <20220705083039.5D339384B072@sourceware.org> (raw)

https://gcc.gnu.org/g:95e2844ef8fa68f7abd45646bae8b4362614bf9c

commit r13-1489-g95e2844ef8fa68f7abd45646bae8b4362614bf9c
Author: Yannick Moy <moy@adacore.com>
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;


                 reply	other threads:[~2022-07-05  8:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220705083039.5D339384B072@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).