]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/ada/ChangeLog
[Ada] Access to uninitialized memory by predicate check
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Jul 2019 07:55:38 +0000 (07:55 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Jul 2019 07:55:38 +0000 (07:55 +0000)
commit89c67bd9086201e449872005623771d43c532263
treece93a484c8270a63ed5a2a499fd930e8c764db03
parentfb739c453c54fc0340bf53706a1ab9c276cdf252
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@273293 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/predicate10.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/predicate10_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/predicate10_pkg.ads [new file with mode: 0644]