aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-03-26 09:02:33 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-21 06:45:03 -0400
commitb1955e0e6dbcc376c8a05ea51751dcce7e210266 (patch)
tree5df3d5a02450d5e62a89e8f24c07b7644bdf650c
parent28741e501f4973982ad02683afe58c06e534b5f3 (diff)
downloadgcc-b1955e0e6dbcc376c8a05ea51751dcce7e210266.zip
gcc-b1955e0e6dbcc376c8a05ea51751dcce7e210266.tar.gz
gcc-b1955e0e6dbcc376c8a05ea51751dcce7e210266.tar.bz2
[Ada] Skip overlay checks on protected components with expansion disabled
gcc/ada/ * sem_util.adb (Find_Overlaid_Entity): Ignore references to components and discriminants.
-rw-r--r--gcc/ada/sem_util.adb12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index b59116e..2e102b9 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -9437,6 +9437,18 @@ package body Sem_Util is
if Is_Entity_Name (Expr) then
Ent := Entity (Expr);
+
+ -- If expansion is disabled, then we might see an entity of a
+ -- protected component or of a discriminant of a concurrent unit.
+ -- Ignore such entities, because further warnings for overlays
+ -- expect this routine to only collect entities of entire objects.
+
+ if Ekind (Ent) in E_Component | E_Discriminant then
+ pragma Assert
+ (not Expander_Active
+ and then Is_Concurrent_Type (Scope (Ent)));
+ Ent := Empty;
+ end if;
return;
-- Check for components