From: Piotr Trojanek Date: Fri, 26 Mar 2021 08:02:33 +0000 (+0100) Subject: [Ada] Skip overlay checks on protected components with expansion disabled X-Git-Tag: basepoints/gcc-13~6635 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b1955e0e6dbcc376c8a05ea51751dcce7e210266;p=thirdparty%2Fgcc.git [Ada] Skip overlay checks on protected components with expansion disabled gcc/ada/ * sem_util.adb (Find_Overlaid_Entity): Ignore references to components and discriminants. --- diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index b59116e540b1..2e102b934970 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