From: Ed Schonberg Date: Fri, 1 Aug 2014 13:50:32 +0000 (+0000) Subject: sem_ch3.adb (Access_Type_Declaration): If designated type is a limited view... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38cea80dc4d9718ea56f959e199ef9d27303e438;p=gcc.git sem_ch3.adb (Access_Type_Declaration): If designated type is a limited view... 2014-08-01 Ed Schonberg * sem_ch3.adb (Access_Type_Declaration): If designated type is a limited view, create a master entity (as is already done for class-wide types) in case the full view designates a type that contains tasks. * sem_ch8.adb (Find_Selected_Component): If prefix is a dereference and the designated type is a limited view, use the non-limited view if available. From-SVN: r213464 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e7f05cb90e8..225c24cafa3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2014-08-01 Ed Schonberg + + * sem_ch3.adb (Access_Type_Declaration): If designated type is + a limited view, create a master entity (as is already done for + class-wide types) in case the full view designates a type that + contains tasks. + * sem_ch8.adb (Find_Selected_Component): If prefix is a dereference + and the designated type is a limited view, use the non-limited + view if available. + 2014-08-01 Eric Botcazou * gcc-interface/ada-tree.h (DECL_BY_DESCRIPTOR_P): Delete. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index dc09c449a8a..a713057db21 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1331,9 +1331,23 @@ package body Sem_Ch3 is if Ekind (Root_Type (Entity (S))) = E_Incomplete_Type then Set_Directly_Designated_Type (T, Entity (S)); + + -- If the designated type is a limited view, we cannot tell if + -- the full view contains tasks, and there is no way to handle + -- that full view in a client. We create a master entity for the + -- scope, which will be used when a client determines that one + -- is needed. + + if From_Limited_With (Entity (S)) + and then not Is_Class_Wide_Type (Entity (S)) + then + Set_Ekind (T, E_Access_Type); + Build_Master_Entity (T); + Build_Master_Renaming (T); + end if; + else - Set_Directly_Designated_Type (T, - Process_Subtype (S, P, T, 'P')); + Set_Directly_Designated_Type (T, Process_Subtype (S, P, T, 'P')); end if; -- If the access definition is of the form: ACCESS NOT NULL .. diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 43eeeb2a96a..5cdb3249516 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -6236,6 +6236,25 @@ package body Sem_Ch8 is Write_Entity_Info (P_Type, " "); Write_Eol; end if; + -- The designated type may be a limited view with no components. + -- Check whether the non-limited view is available, because in some + -- cases this will not be set when instlling the context. + + if Is_Access_Type (P_Type) then + declare + D : constant Entity_Id := Directly_Designated_Type (P_Type); + begin + if Is_Incomplete_Type (D) + and then not Is_Class_Wide_Type (D) + and then From_Limited_With (D) + and then Present (Non_Limited_View (D)) + and then not Is_Class_Wide_Type (Non_Limited_View (D)) + then + Set_Directly_Designated_Type (P_Type, Non_Limited_View (D)); + end if; + end; + end if; + -- First check for components of a record object (not the -- result of a call, which is handled below).