aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-12-14 13:54:28 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-04-29 04:00:45 -0400
commitc3b77813eed1060b96f69cc90b761408bcbc6bb0 (patch)
tree6b8b2667b14c9058a7574bb54f7ae3cc63287159
parent02ba09894f669a69936e1f4b43cfa0e8385e0c84 (diff)
downloadgcc-c3b77813eed1060b96f69cc90b761408bcbc6bb0.zip
gcc-c3b77813eed1060b96f69cc90b761408bcbc6bb0.tar.gz
gcc-c3b77813eed1060b96f69cc90b761408bcbc6bb0.tar.bz2
[Ada] Crash on predicated constrained out_parameter
gcc/ada/ * sem_util.adb (Build_Constrained_Itype): Inhibit the generation of predicate functions for this Itype, which is created for an aggregate of a discriminated type. The object to which the aggregate is assigned, e.g a writable actual parameter, will apply the predicates if any are inherited from the base type.
-rw-r--r--gcc/ada/sem_util.adb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index b7b622d..a64cbde 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -2380,6 +2380,14 @@ package body Sem_Util is
Analyze (Subtyp_Decl, Suppress => All_Checks);
+ -- In addition, inhibit the generation of predicate functions for
+ -- this subtype, because its declaration is not in a declarative
+ -- list, and no predicates apply to the aggregate itself, but only
+ -- to the object to which it may be assigned.
+
+ Set_Has_Dynamic_Predicate_Aspect (Def_Id, False);
+ Set_Has_Predicates (Def_Id, False);
+
Set_Etype (N, Def_Id);
end Build_Constrained_Itype;