From 3452f4b72db6630ab80cb16d8cff2a5e531f4820 Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Sat, 16 May 2020 11:59:50 -0400 Subject: [PATCH] [Ada] Check predicates for subtypes of private types gcc/ada/ * sem_ch13.adb (Analyze_Aspect_Specifications): Add freeze node for the Underlying_Full_View if it exists. The freeze node is what triggers the generation of the predicate function. * freeze.adb: Minor reformatting. --- gcc/ada/freeze.adb | 7 ++----- gcc/ada/sem_ch13.adb | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 7c6fac155ee..cb32f9d3c13 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -6175,8 +6175,7 @@ package body Freeze is if Present (F_Node) then Inherit_Freeze_Node - (Fnod => F_Node, - Typ => Full_View (E)); + (Fnod => F_Node, Typ => Full_View (E)); else Set_Has_Delayed_Freeze (Full_View (E), False); Set_Freeze_Node (Full_View (E), Empty); @@ -6187,9 +6186,7 @@ package body Freeze is F_Node := Freeze_Node (Full_View (E)); if Present (F_Node) then - Inherit_Freeze_Node - (Fnod => F_Node, - Typ => E); + Inherit_Freeze_Node (Fnod => F_Node, Typ => E); else -- {Incomplete,Private}_Subtypes with Full_Views -- constrained by discriminants. diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index f854711a0a5..4c8c650b427 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -3051,6 +3051,21 @@ package body Sem_Ch13 is Set_Has_Delayed_Aspects (Full_View (E)); Ensure_Freeze_Node (Full_View (E)); + + -- If there is an Underlying_Full_View, also create a + -- freeze node for that one. + + if Is_Private_Type (Full_View (E)) then + declare + U_Full : constant Entity_Id := + Underlying_Full_View (Full_View (E)); + begin + if Present (U_Full) then + Set_Has_Delayed_Aspects (U_Full); + Ensure_Freeze_Node (U_Full); + end if; + end; + end if; end if; -- Predicate_Failure -- 2.30.2