public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/guojiufu-branch)] [Ada] Issue with unnesting of 'First/Last and renaming
@ 2020-06-10  3:44 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-06-10  3:44 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8b0ec65d852c11fde3937629d10c6b24083b5737

commit 8b0ec65d852c11fde3937629d10c6b24083b5737
Author: Richard Kenner <kenner@adacore.com>
Date:   Mon Feb 17 18:17:58 2020 -0500

    [Ada] Issue with unnesting of 'First/Last and renaming
    
    2020-06-08  Richard Kenner  <kenner@adacore.com>
    
    gcc/ada/
    
            * exp_unst.adb (Visit_Node): When visiting array attribute
            nodes, in addition to checking the type of Get_Referenced_Object
            of the prefix, also check the actual type of the prefix.

Diff:
---
 gcc/ada/exp_unst.adb | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
index ade5fe0cfac..953d449bbc9 100644
--- a/gcc/ada/exp_unst.adb
+++ b/gcc/ada/exp_unst.adb
@@ -1049,22 +1049,27 @@ package body Exp_Unst is
                            --  from the (possibly) uplevel reference. We call
                            --  Get_Referenced_Object to deal with prefixes that
                            --  are object renamings (prefixes that are types
-                           --  can be passed and will simply be returned).
+                           --  can be passed and will simply be returned).  But
+                           --  it's also legal to get the bounds from the type
+                           --  of the prefix, so we have to handle both cases.
 
-                           if Is_Constrained
+                           declare
+                              DT : Boolean := False;
+
+                           begin
+                              if Is_Constrained
                                 (Etype (Get_Referenced_Object (Prefix (N))))
-                           then
-                              declare
-                                 DT : Boolean := False;
-                              begin
+                              then
                                  Check_Static_Type
                                    (Etype (Get_Referenced_Object (Prefix (N))),
-                                    Empty,
-                                    DT);
-                              end;
+                                    Empty, DT);
+                              end if;
 
-                              return OK;
-                           end if;
+                              if Is_Constrained (Etype (Prefix (N))) then
+                                 Check_Static_Type
+                                   (Etype (Prefix (N)), Empty, DT);
+                              end if;
+                           end;
 
                         when others =>
                            null;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-10  3:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10  3:44 [gcc(refs/users/guojiufu/heads/guojiufu-branch)] [Ada] Issue with unnesting of 'First/Last and renaming Jiu Fu Guo

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).