]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix propagation of compiler internal flag
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Aug 2019 09:50:05 +0000 (09:50 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Aug 2019 09:50:05 +0000 (09:50 +0000)
No change in behavior for GCC-based compilations.

2019-08-20  Ed Schonberg  <schonberg@adacore.com>

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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@274735 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb

index 238df0fe174bd2ae2a96935477c61b3d949448a2..eeb991154916931b592b6fa4c553e18995ed5951 100644 (file)
@@ -1,3 +1,10 @@
+2019-08-20  Ed Schonberg  <schonberg@adacore.com>
+
+       * 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  <schonberg@adacore.com>
 
        * exp_attr.adb (Expand_Loop_Entry_Attribute): When expanding a
index 4afa3a69083260f556943b5048448e8cea1ca0b3..f3acae1dd27483d4673ef9f701bf46e715e6b489 100644 (file)
@@ -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);