aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2019-07-04 08:06:19 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-04 08:06:19 +0000
commitdd4d8a71980487ddb4ac6c1ad0a1b8fb6c143592 (patch)
treec93ad7b864d97bb11f4e6f99ccf4e04e99766f1e /gcc/ada
parent7cbdab5aa839ffd54dccbde6430905bb9c596201 (diff)
downloadgcc-dd4d8a71980487ddb4ac6c1ad0a1b8fb6c143592.zip
gcc-dd4d8a71980487ddb4ac6c1ad0a1b8fb6c143592.tar.gz
gcc-dd4d8a71980487ddb4ac6c1ad0a1b8fb6c143592.tar.bz2
[Ada] Assertion failure on Default_Initial_Condition
This patch prevents the association of a Default_Initial_Condition with an incomplete type whose full view is the private type or private extension subject to the aspect/pragma. 2019-07-04 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_util.adb (Propagate_DIC_Attributes): Do not propagate the Default_Initial_Condition attributes to an incomplete type. gcc/testsuite/ * gnat.dg/default_initial_condition.adb, gnat.dg/default_initial_condition_pack.adb, gnat.dg/default_initial_condition_pack.ads: New testcase. From-SVN: r273059
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_util.adb7
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index be26421..2925c84 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-04 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_util.adb (Propagate_DIC_Attributes): Do not propagate the
+ Default_Initial_Condition attributes to an incomplete type.
+
2019-07-04 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Array_Type): An array type attribute such
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 4d19c61..868e93e 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -23327,6 +23327,13 @@ package body Sem_Util is
if From_Typ = Typ then
return;
+
+ -- Nothing to do when the destination denotes an incomplete type
+ -- because the DIC is associated with the current instance of a
+ -- private type, thus it can never apply to an incomplete type.
+
+ elsif Is_Incomplete_Type (Typ) then
+ return;
end if;
DIC_Proc := DIC_Procedure (From_Typ);