aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2019-08-20 09:50:05 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-20 09:50:05 +0000
commitb08f42aecfe0d2c70c2fa81601f2ec86d3ffea30 (patch)
tree1c7b7dbc00b9b52553d5f114938a9be55644657d
parentb6b011dd38da56a04dbf7d27833d015f2789a6f5 (diff)
downloadgcc-b08f42aecfe0d2c70c2fa81601f2ec86d3ffea30.zip
gcc-b08f42aecfe0d2c70c2fa81601f2ec86d3ffea30.tar.gz
gcc-b08f42aecfe0d2c70c2fa81601f2ec86d3ffea30.tar.bz2
[Ada] Fix propagation of compiler internal flag
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. From-SVN: r274735
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_ch3.adb16
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 238df0f..eeb9911 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,12 @@
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
loop entry attribute for a while_loop we construct a function
that incorporates the expanded condition of the loop. The itypes
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 4afa3a6..f3acae1 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);