]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Crash on predicated constrained out_parameter
authorEd Schonberg <schonberg@adacore.com>
Mon, 14 Dec 2020 18:54:28 +0000 (13:54 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 29 Apr 2021 08:00:45 +0000 (04:00 -0400)
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.

gcc/ada/sem_util.adb

index b7b622dbcca9f1d9fa0b3f5f6e3a6fdd0230a1a4..a64cbde17edfb1d80c72952e44ea54dd25f64cc6 100644 (file)
@@ -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;