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-834] [Ada] Do not analyze expression functions for dispatch tables
Date: Mon, 30 May 2022 08:30:37 +0000 (GMT)	[thread overview]
Message-ID: <20220530083037.50BE53857343@sourceware.org> (raw)

https://gcc.gnu.org/g:79b7ab68bce24103adc388d184ff74755914cdda

commit r13-834-g79b7ab68bce24103adc388d184ff74755914cdda
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Apr 22 22:27:22 2022 +0200

    [Ada] Do not analyze expression functions for dispatch tables
    
    There is no need to analyze expression functions that are primitives of a
    tagged type for its dispatch table because they will be analyzed at the end
    of the current scope.
    
    gcc/ada/
    
            * sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Don't analyze
            the body of an expression function in the case of a dispatch table.

Diff:
---
 gcc/ada/sem_attr.adb | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 7b05cdc2bd6..e6e06f605fa 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -12144,11 +12144,15 @@ package body Sem_Attr is
                      elsif Scope (Subp_Id) /= Current_Scope then
                         null;
 
+                     --  Dispatch tables are not a freeze point either
+
+                     elsif Nkind (Parent (N)) = N_Unchecked_Type_Conversion
+                       and then Is_Dispatch_Table_Entity (Etype (Parent (N)))
+                     then
+                        null;
+
                       --  Analyze the body of the expression function to freeze
-                      --  the expression. This takes care of the case where the
-                      --  'Access is part of dispatch table initialization and
-                      --  the generated body of the expression function has not
-                      --  been analyzed yet.
+                      --  the expression.
 
                      else
                         Analyze (Subp_Body);


                 reply	other threads:[~2022-05-30  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=20220530083037.50BE53857343@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).