[Ada] Crash on precondition involving quantified expression
authorEd Schonberg <schonberg@adacore.com>
Wed, 14 Aug 2019 09:51:00 +0000 (09:51 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 14 Aug 2019 09:51:00 +0000 (09:51 +0000)
commitcc248146c12018675f203f6be6b4d652765f0f76
tree42d5a622c24b88563edc8a26c802e88b2146640f
parentbab15911661814606d18639ef53597ea9a843afa
[Ada] Crash on precondition involving quantified expression

This patch fixes a compiler abort on a precondition whose condition
includes a quantified expression.

2019-08-14  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_util.adb (New_Copy_Tree, Visit_Entity): A quantified
expression includes the implicit declaration of the loop
parameter. When a quantified expression is copied during
expansion, for example when building the precondition code from
the generated pragma, a new loop parameter must be created for
the new tree, to prevent duplicate declarations for the same
symbol.

gcc/testsuite/

* gnat.dg/predicate12.adb, gnat.dg/predicate12.ads: New
testcase.

From-SVN: r274449
gcc/ada/ChangeLog
gcc/ada/sem_util.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/predicate12.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/predicate12.ads [new file with mode: 0644]