From b1955e0e6dbcc376c8a05ea51751dcce7e210266 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Fri, 26 Mar 2021 09:02:33 +0100 Subject: [PATCH] [Ada] Skip overlay checks on protected components with expansion disabled gcc/ada/ * sem_util.adb (Find_Overlaid_Entity): Ignore references to components and discriminants. --- gcc/ada/sem_util.adb | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 -- 2.7.4