aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-02-17 18:01:52 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-23 09:59:04 +0200
commitea5a7a774a2d5d2759f45c77efa17a91182e614f (patch)
tree3b76635b0b314c5c3afc8a08164137b1674a8a90 /gcc/ada/sem_ch3.adb
parentdb338ee106ab912c2a318b74fe7534071a0e6729 (diff)
downloadgcc-ea5a7a774a2d5d2759f45c77efa17a91182e614f.zip
gcc-ea5a7a774a2d5d2759f45c77efa17a91182e614f.tar.gz
gcc-ea5a7a774a2d5d2759f45c77efa17a91182e614f.tar.bz2
ada: Fix bogus error on predicated limited record declared in protected type
This happens when the limited record is initialized with a function call because of a couple of issues: incorrect tree sharing when building the predicate check and too late freezing for a compiler-generated subtype. It turns out that building the predicate check manually is redundant here, since predicate checks are automatically generated during the expansion of assignment statements, and the late freezing can be easily fixed. gcc/ada/ * exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Do not manually generate a predicate check. Call Unqualify before doing pattern matching on the expression. * sem_ch3.adb (Analyze_Object_Declaration): Also freeze the actual subtype when it is built in the definite case.
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 2ebbe36..bace2cf 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -4971,6 +4971,7 @@ package body Sem_Ch3 is
end if;
Rewrite (Object_Definition (N), New_Occurrence_Of (Act_T, Loc));
+ Freeze_Before (N, Act_T);
elsif Nkind (E) = N_Function_Call
and then Constant_Present (N)