aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2018-11-14 11:41:46 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-11-14 11:41:46 +0000
commitb7c34dff67750bf38d8b8d89ea44c01d8c7c5870 (patch)
tree05250ad3367e561bee78911884597e2235d93b1d /gcc/ada
parent41a59f6b14660aaf802d749a22d07c14660312ed (diff)
downloadgcc-b7c34dff67750bf38d8b8d89ea44c01d8c7c5870.zip
gcc-b7c34dff67750bf38d8b8d89ea44c01d8c7c5870.tar.gz
gcc-b7c34dff67750bf38d8b8d89ea44c01d8c7c5870.tar.bz2
[Ada] Crash on use of generic formal package
This patch fixes an issue whereby a complicated set of generic formal packages in conjunction with use_clauses may cause a crash during visibility checking due to a homonym being out of scope during the checking stage. 2018-11-14 Justin Squirek <squirek@adacore.com> gcc/ada/ * sem_ch8.adb (Use_One_Package): Add test for out-of-scope homonyms. gcc/testsuite/ * gnat.dg/generic_pkg.adb: New testcase. From-SVN: r266126
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_ch8.adb5
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6be8341..d4dcd8c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-14 Justin Squirek <squirek@adacore.com>
+
+ * sem_ch8.adb (Use_One_Package): Add test for out-of-scope
+ homonyms.
+
2018-11-14 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb: (Expand_N_Object_Declaration): If the expression
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index fd0e444..a1bcbff 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -9685,12 +9685,17 @@ package body Sem_Ch8 is
-- current one would have been visible, so make the other one
-- not use_visible.
+ -- In certain pathological cases it is possible that unrelated
+ -- homonyms from distinct formal packages may exist in an
+ -- uninstalled scope. We must test for that here.
+
elsif Present (Current_Instance)
and then Is_Potentially_Use_Visible (Prev)
and then not Is_Overloadable (Prev)
and then Scope (Id) /= Scope (Prev)
and then Used_As_Generic_Actual (Scope (Prev))
and then Used_As_Generic_Actual (Scope (Id))
+ and then Is_List_Member (Scope (Prev))
and then not In_Same_List (Current_Use_Clause (Scope (Prev)),
Current_Use_Clause (Scope (Id)))
then