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 r12-3754] [Ada] Spurious dynamic accessibility check on allocator
Date: Tue, 21 Sep 2021 15:28:06 +0000 (GMT)	[thread overview]
Message-ID: <20210921152806.6C0F53857803@sourceware.org> (raw)

https://gcc.gnu.org/g:7d9735bbb88b6e61e5405d7c99e6cc97112e7a41

commit r12-3754-g7d9735bbb88b6e61e5405d7c99e6cc97112e7a41
Author: Justin Squirek <squirek@adacore.com>
Date:   Thu Jul 8 20:33:05 2021 -0400

    [Ada] Spurious dynamic accessibility check on allocator
    
    gcc/ada/
    
            * sem_util.adb (Accessibility_Level): Remove spurious special
            case for protected type components.
            * exp_ch4.adb (Generate_Accessibility_Check): Use general
            Accessibility_Level instead of the low-level function
            Type_Access_Level.

Diff:
---
 gcc/ada/exp_ch4.adb  |  3 +--
 gcc/ada/sem_util.adb | 11 -----------
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index cf9899d76c8..497a52ba05d 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -767,8 +767,7 @@ package body Exp_Ch4 is
             Cond :=
               Make_Op_Gt (Loc,
                 Left_Opnd  => Cond,
-                Right_Opnd =>
-                  Make_Integer_Literal (Loc, Type_Access_Level (PtrT)));
+                Right_Opnd => Accessibility_Level (N, Dynamic_Level));
 
             --  Due to the complexity and side effects of the check, utilize an
             --  if statement instead of the regular Program_Error circuitry.
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 5fd72667e99..45a338a927b 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -728,17 +728,6 @@ package body Sem_Util is
                return Make_Level_Literal
                         (Typ_Access_Level (Etype (E)));
 
-            --  When E is a component of the current instance of a
-            --  protected type, we assume the level to be deeper than that of
-            --  the type itself.
-
-            elsif not Is_Overloadable (E)
-              and then Ekind (Scope (E)) = E_Protected_Type
-              and then Comes_From_Source (Scope (E))
-            then
-               return Make_Level_Literal
-                        (Scope_Depth (Enclosing_Dynamic_Scope (E)) + 1);
-
             --  Check if E is an expansion-generated renaming of an iterator
             --  by examining Related_Expression. If so, determine the
             --  accessibility level based on the original expression.


                 reply	other threads:[~2021-09-21 15:28 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=20210921152806.6C0F53857803@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).