[Ada] Access to uninitialized memory by predicate check
This patch fixes an exception or erroneous execution, when the
declaration for an object of a composite type that has a dynanic
predicate is initialized with an aggregate that requires expansion into
individual components. Prior to this patch the predicate check for the
object appeared before intialization was performed, thus accessing
uninitialized memory.
2019-07-09 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch3.adb (Analyze_Object_Declaration): If the object type
is a composite type that has a dynamic predicate and, the
expression in the declaration is an aggregate, the generated
predicate check must appear after the expanded code for the
aggregate, which will appear after the rewritten object
declarastion.
gcc/testsuite/
* gnat.dg/predicate10.adb, gnat.dg/predicate10_pkg.adb,
gnat.dg/predicate10_pkg.ads: New testcase.
From-SVN: r273293