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-6252] [Ada] Improve support for casing on types with controlled parts
Date: Wed,  5 Jan 2022 11:35:45 +0000 (GMT)	[thread overview]
Message-ID: <20220105113545.05ABD3858434@sourceware.org> (raw)

https://gcc.gnu.org/g:5e51d85e2e739cbe8a0c7081d300c12c5b5447b2

commit r12-6252-g5e51d85e2e739cbe8a0c7081d300c12c5b5447b2
Author: Steve Baird <baird@adacore.com>
Date:   Wed Dec 1 11:02:52 2021 -0800

    [Ada] Improve support for casing on types with controlled parts
    
    gcc/ada/
    
            * exp_ch5.adb (Finish_Binding_Object_Declaration): Fix a bug
            that was introduced in the previous commit.  The previous
            version initialized a Boolean constant Declare_Copy before the
            variable Decl had been initialized properly.

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

diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 42cffd5186a..b73a966faa2 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -3392,12 +3392,12 @@ package body Exp_Ch5 is
                Decl         : Node_Id := First (Declarations (Block_Stmt));
                Def_Id       : Node_Id := Empty;
 
+               function Declare_Copy (Decl : Node_Id) return Boolean is
+                 (Nkind (Decl) = N_Object_Declaration);
                --  Declare_Copy indicates which of the two approaches
                --  was chosen during analysis: declare (and initialize)
                --  a new variable, or use access values to declare a renaming
                --  of the appropriate subcomponent of the selector value.
-               Declare_Copy : constant Boolean :=
-                 Nkind (Decl) = N_Object_Declaration;
 
                function Make_Conditional (Stmt : Node_Id) return Node_Id;
                --  If there is only one choice for this alternative, then
@@ -3443,7 +3443,7 @@ package body Exp_Ch5 is
                end loop;
 
                --  For a binding object, we sometimes make a copy and
-               --  sometimes introduce  a renaming. That decision is made
+               --  sometimes introduce a renaming. That decision is made
                --  elsewhere. The renaming case involves dereferencing an
                --  access value because of the possibility of multiple
                --  choices (with multiple binding definitions) for a single
@@ -3452,7 +3452,7 @@ package body Exp_Ch5 is
                --  renaming case, we initialize (again, maybe conditionally)
                --  the access value.
 
-               if Declare_Copy then
+               if Declare_Copy (Decl) then
                   declare
                      Assign_Value : constant Node_Id  :=
                        Make_Assignment_Statement (Loc,


                 reply	other threads:[~2022-01-05 11:35 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=20220105113545.05ABD3858434@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).