From: Ed Schonberg Date: Tue, 20 Aug 2019 09:50:05 +0000 (+0000) Subject: [Ada] Fix propagation of compiler internal flag X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b08f42aecfe0d2c70c2fa81601f2ec86d3ffea30;p=gcc.git [Ada] Fix propagation of compiler internal flag No change in behavior for GCC-based compilations. 2019-08-20 Ed Schonberg gcc/ada/ * sem_ch3.adb (Analyze_Object_Declaration): If actual type is private and distinct from nominal type in declaration, propagate flags Is_Constr_Subt_For_U_Nominal and _UN_Aliased to full view of private type. From-SVN: r274735 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 238df0fe174..eeb99115491 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-08-20 Ed Schonberg + + * sem_ch3.adb (Analyze_Object_Declaration): If actual type is + private and distinct from nominal type in declaration, propagate + flags Is_Constr_Subt_For_U_Nominal and _UN_Aliased to full view + of private type. + 2019-08-20 Ed Schonberg * exp_attr.adb (Expand_Loop_Entry_Attribute): When expanding a diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 4afa3a69083..f3acae1dd27 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3923,6 +3923,7 @@ package body Sem_Ch3 is -- Save the Ghost-related attributes to restore on exit Related_Id : Entity_Id; + Full_View_Present : Boolean := False; -- Start of processing for Analyze_Object_Declaration @@ -4645,10 +4646,25 @@ package body Sem_Ch3 is Act_T := Find_Type_Of_Object (Object_Definition (N), N); end if; + -- Propagate attributes to full view when needed. + Set_Is_Constr_Subt_For_U_Nominal (Act_T); + if Is_Private_Type (Act_T) and then Present (Full_View (Act_T)) + then + Full_View_Present := True; + end if; + + if Full_View_Present then + Set_Is_Constr_Subt_For_U_Nominal (Full_View (Act_T)); + end if; + if Aliased_Present (N) then Set_Is_Constr_Subt_For_UN_Aliased (Act_T); + + if Full_View_Present then + Set_Is_Constr_Subt_For_UN_Aliased (Full_View (Act_T)); + end if; end if; Freeze_Before (N, Act_T);