aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-09-23 19:06:54 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-09-29 11:08:46 +0200
commit01ea0437ead0dda3acd51cfb80a01de5feb56929 (patch)
treefed64b56dcb28db8a2e6735a7a6660fb3c0d2e3f
parenta1cd4d52d6ef90b977fb2d80c1cf17f3efa5b01d (diff)
downloadgcc-01ea0437ead0dda3acd51cfb80a01de5feb56929.zip
gcc-01ea0437ead0dda3acd51cfb80a01de5feb56929.tar.gz
gcc-01ea0437ead0dda3acd51cfb80a01de5feb56929.tar.bz2
ada: Fix checking of Refined_State with nested package renamings
When collecting package state declared in package body, we should only recursively examine the visible part of nested packages while ignoring other entities related to packages (e.g. package bodies or package renamings). gcc/ada/ * sem_util.adb (Collect_Visible_States): Ignore package renamings.
-rw-r--r--gcc/ada/sem_util.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 9ae082c..25e886e 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -6018,8 +6018,11 @@ package body Sem_Util is
Append_New_Elmt (Item_Id, States);
-- Recursively gather the visible states of a nested package
+ -- except for nested package renamings.
- elsif Ekind (Item_Id) = E_Package then
+ elsif Ekind (Item_Id) = E_Package
+ and then No (Renamed_Entity (Item_Id))
+ then
Collect_Visible_States (Item_Id, States);
end if;