public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] [Ada] Wrong resolution of 'access in protected subprogram
@ 2020-08-22 23:41 Giuliano Belinassi
  0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 23:41 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0a253f42792623585789133655679b5c4065b5ba

commit 0a253f42792623585789133655679b5c4065b5ba
Author: Javier Miranda <miranda@adacore.com>
Date:   Tue Jun 2 15:46:10 2020 -0400

    [Ada] Wrong resolution of 'access in protected subprogram
    
    gcc/ada/
    
            * sem_attr.adb (Resolve_Attribute): Resolve overloaded
            N_Selected_Component prefix of 'Access. Required to handle
            overloaded prefixed view of protected subprograms.

Diff:
---
 gcc/ada/sem_attr.adb | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 80e8f099e37..1a80e798eab 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -11023,7 +11023,29 @@ package body Sem_Attr is
                end if;
 
                Resolve (Prefix (P));
-               Generate_Reference (Entity (Selector_Name (P)), P);
+
+               if not Is_Overloaded (P) then
+                  Generate_Reference (Entity (Selector_Name (P)), P);
+
+               else
+                  Get_First_Interp (P, Index, It);
+                  while Present (It.Nam) loop
+                     if Type_Conformant (Designated_Type (Typ), It.Nam) then
+                        Set_Entity (Selector_Name (P), It.Nam);
+
+                        --  The prefix is definitely NOT overloaded anymore at
+                        --  this point, so we reset the Is_Overloaded flag to
+                        --  avoid any confusion when reanalyzing the node.
+
+                        Set_Is_Overloaded (P, False);
+                        Set_Is_Overloaded (N, False);
+                        Generate_Reference (Entity (Selector_Name (P)), P);
+                        exit;
+                     end if;
+
+                     Get_Next_Interp (Index, It);
+                  end loop;
+               end if;
 
             --  Implement check implied by 3.10.2 (18.1/2) : F.all'access is
             --  statically illegal if F is an anonymous access to subprogram.


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

only message in thread, other threads:[~2020-08-22 23:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 23:41 [gcc/devel/autopar_devel] [Ada] Wrong resolution of 'access in protected subprogram Giuliano Belinassi

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