[Ada] Fix internal error on predicate aspect with iterator
commit861b78a946b0d0936baed97fb17fe3c7b300a8c5
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 9 Mar 2022 19:47:00 +0000 (9 20:47 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 16 May 2022 08:42:03 +0000 (16 08:42 +0000)
treef8625731ca2c2ba3d78c4a9c1a8cc5dfbc73e07e
parent7c88e46a270212180767fc585dd190b7713702db
[Ada] Fix internal error on predicate aspect with iterator

The semantic analysis of predicates involves a fair amount of tree
copying because of both semantic and implementation considerations, and
there is a difficulty with quantified expressions since they declare a
new entity that cannot be shared between the various copies of the tree.

This change implements a specific processing for it in New_Copy_Tree
that subsumes a couple of fixes made earlier for variants of the issue.

gcc/ada/

* sem_util.ads (Is_Entity_Of_Quantified_Expression): Declare.
* sem_util.adb (Is_Entity_Of_Quantified_Expression): New
predicate.
(New_Copy_Tree): Deal with all entities of quantified
expressions.
* sem_ch13.adb (Build_Predicate_Functions): Get rid of
superfluous tree copying and remove obsolete code.
* sem_ch6.adb (Fully_Conformant_Expressions): Deal with all
entities of quantified expressions.
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads