[Ada] Crash with private types and renamed discriminants
authorEd Schonberg <schonberg@adacore.com>
Tue, 22 May 2018 13:23:51 +0000 (13:23 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 22 May 2018 13:23:51 +0000 (13:23 +0000)
commitfbb539954efc29574ff0a8399d88d6525a35c17a
tree4cc8305fdeadf9ca63282da3036cf691be1f49d6
parent651822aec7caa0ed1aa8cb3dfb07a380b4595b08
[Ada] Crash with private types and renamed discriminants

This patch fixes a compiler abort on an object declaration whose type
is a private type with discriminants, and whose full view is a derived
type that renames some discriminant of its parent.

2018-05-22  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch3.adb (Search_Derivation_Levels): Whenever a parent type is
private, use the full view if available, because it may include renamed
discriminants whose values are stored in the corresponding
Stored_Constraint.

gcc/testsuite/

* gnat.dg/discr49.adb, gnat.dg/discr49_rec1.adb,
gnat.dg/discr49_rec1.ads, gnat.dg/discr49_rec2.adb,
gnat.dg/discr49_rec2.ads: New testcase.

From-SVN: r260521
gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/discr49.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/discr49_rec1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/discr49_rec1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/discr49_rec2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/discr49_rec2.ads [new file with mode: 0644]