public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-396] [Ada] Do not overwrite limited view of result type
@ 2022-05-13  8:08 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-13  8:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:85df62468c26335d7d771f319620f7a51f58e448

commit r13-396-g85df62468c26335d7d771f319620f7a51f58e448
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Sat Feb 19 12:30:47 2022 +0100

    [Ada] Do not overwrite limited view of result type
    
    This removes obsolete code that overwrites a limited view present as the
    result type of a function during the tentative analysis of prefixed
    views for function calls involving tagged types. The original view is
    necessary for the code generator to break the circularity present in
    this setup.
    
    The change also adds a couple of guards for the illegal case where the
    limited view is the only view available when the function is invoked.
    
    gcc/ada/
    
            * aspects.adb (Find_Value_Of_Aspect): Add guard.
            * sem_ch4.adb (Complete_Object_Operation): Remove obsolete code.
            * sem_ch5.adb (Has_Sec_Stack_Default_Iterator): Add guard.

Diff:
---
 gcc/ada/aspects.adb |  4 +++-
 gcc/ada/sem_ch4.adb | 13 -------------
 gcc/ada/sem_ch5.adb |  1 +
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb
index 62603d6b4ba..3471a81f176 100644
--- a/gcc/ada/aspects.adb
+++ b/gcc/ada/aspects.adb
@@ -285,7 +285,9 @@ package body Aspects is
 
    begin
       if Present (Spec) then
-         if A = Aspect_Default_Iterator then
+         if A = Aspect_Default_Iterator
+           and then Present (Aspect_Rep_Item (Spec))
+         then
             return Expression (Aspect_Rep_Item (Spec));
          else
             return Expression (Spec);
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 5987b796ae2..ad7448fedb5 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -9248,19 +9248,6 @@ package body Sem_Ch4 is
             Save_Interps (Subprog, Node_To_Replace);
 
          else
-            --  The type of the subprogram may be a limited view obtained
-            --  transitively from another unit. If full view is available,
-            --  use it to analyze call. If there is no nonlimited view, then
-            --  this is diagnosed when analyzing the rewritten call.
-
-            declare
-               T : constant Entity_Id := Etype (Subprog);
-            begin
-               if From_Limited_With (T) then
-                  Set_Etype (Entity (Subprog), Available_View (T));
-               end if;
-            end;
-
             Analyze (Node_To_Replace);
 
             --  If the operation has been rewritten into a call, which may get
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index a0f22060007..0a836089d95 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -3675,6 +3675,7 @@ package body Sem_Ch5 is
          begin
             return
               Present (Def_Iter)
+                and then Present (Etype (Def_Iter))
                 and then Requires_Transient_Scope (Etype (Def_Iter));
          end Has_Sec_Stack_Default_Iterator;


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

only message in thread, other threads:[~2022-05-13  8:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13  8:08 [gcc r13-396] [Ada] Do not overwrite limited view of result type Pierre-Marie de Rodat

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