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-411] [Ada] Storage_Model_Object fails to return object entity
Date: Fri, 13 May 2022 08:09:38 +0000 (GMT)	[thread overview]
Message-ID: <20220513080938.2BCA4384BC2B@sourceware.org> (raw)

https://gcc.gnu.org/g:ba75fee24d91eb241b5784a8a55175c294b040ab

commit r13-411-gba75fee24d91eb241b5784a8a55175c294b040ab
Author: Gary Dismukes <dismukes@adacore.com>
Date:   Fri Mar 4 17:19:18 2022 -0500

    [Ada] Storage_Model_Object fails to return object entity
    
    After a compilation unit containing a Designated_Storage_Model aspect
    was processed by the compiler front end, the aspect's expression was
    seen as not having been analyzed. In some cases this can lead to the
    Storage_Model_Object function not returning the entity of the associated
    model object (such as when the model object is specified using an
    expanded name). This was due to a second copy of the aspect's expression
    being made in Check_Aspect_At_Freeze_Point, and that copy wasn't
    analyzed, even though the earlier version of the expression prior to
    that copy had been. (The copy is needed for proper checking of Ada's
    rules for ensuring that certain aspect expressions resolve the same way
    at the freeze point and later at the end of the declarations.) This is
    corrected by doing analysis of the new aspect expression within
    Check_Aspect_At_Freeze_Point, as is already done in that procedure in
    the case of several other aspects.
    
    gcc/ada/
    
            * sem_ch13.adb (Check_Aspect_At_Freeze_Point): Analyze the
            expression of the aspect at this point, like other aspects that
            denote simple entities. Ensures that function
            Storage_Model_Object will have an entity to retrieve from the
            aspect expression. Also, move comment about aspects that don't
            require delay analysis in front of last alternative of the case
            statement, where it's supposed to be.

Diff:
---
 gcc/ada/sem_ch13.adb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 3cac123b134..61f7ba78a94 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -11359,9 +11359,11 @@ package body Sem_Ch13 is
          when Aspect_Predicate_Failure =>
             T := Standard_String;
 
-         --  Here is the list of aspects that don't require delay analysis
+         --  As for some other aspects above, the expression of this aspect is
+         --  just an entity that does not need any resolution, so just analyze.
 
          when Aspect_Designated_Storage_Model =>
+            Analyze (Expression (ASN));
             return;
 
          when Aspect_Storage_Model_Type =>
@@ -11389,6 +11391,8 @@ package body Sem_Ch13 is
 
             return;
 
+         --  Here is the list of aspects that don't require delay analysis
+
          when Aspect_Abstract_State
             | Aspect_Annotate
             | Aspect_Async_Readers


                 reply	other threads:[~2022-05-13  8:09 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=20220513080938.2BCA4384BC2B@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).