[Ada] Ineffective use type clause warnings cause compile time crash
authorJustin Squirek <squirek@adacore.com>
Mon, 14 Feb 2022 20:51:49 +0000 (20:51 +0000)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 13 May 2022 08:04:24 +0000 (08:04 +0000)
commit8a8366d4969e87366a94d9f2b768606fdf46a7b2
treeab767dafc448f7f86859d0282b74f247d7b5a6ef
parentbac63f1ea9121a59e980981cfb8b2ea1869f12f0
[Ada] Ineffective use type clause warnings cause compile time crash

This patch corrects an error in the compiler whereby the presence of a
generic instance featuring a use type clause at library level may cause
a crash at compile time when warnings for ineffective use clauses are
enabled and the type in question is already use visible.

gcc/ada/

* sem_ch8.adb (Determine_Package_Scope): Created to centralize
the calculation of which package a given use clause belongs to.
(Most_Descendant_Use_Clause): Modified to call
Determine_Package_Scope.
* sem_util.adb, sem_util.ads (Enclosing_Package): Modified to
handle both entity and node ids.
gcc/ada/sem_ch8.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads