From: Ed Schonberg Date: Thu, 12 Dec 2019 10:02:47 +0000 (+0000) Subject: [Ada] Spurious visibility error on subunit with optimization X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c9312e3079094e6255f7b5603475f7cd1cb517aa;p=gcc.git [Ada] Spurious visibility error on subunit with optimization 2019-12-12 Ed Schonberg gcc/ada/ * sem_ch10.adb (Analyze_Subunit): Fix spurious visibility error on subunit with optimization. From-SVN: r279291 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f911670d4ec..48448b2a019 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-12-12 Ed Schonberg + + * sem_ch10.adb (Analyze_Subunit): Fix spurious visibility error + on subunit with optimization. + 2019-12-12 Arnaud Charlet * raise-gcc.c (__gnat_personality_v0): Define for SEH. diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index c5d10f761b1..16f0807fc86 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -2226,9 +2226,18 @@ package body Sem_Ch10 is -- If the subunit occurs within a child unit, we must restore the -- immediate visibility of any siblings that may occur in context. + -- In addition, we must reset the previous visibility of the + -- parent unit which is now on the scope stack. This is because + -- the Previous_Visibility was previously set when removing the + -- context. This is necessary to prevent the parent entity from + -- remaining visible after the subunit is compiled. This only + -- has an effect if a homonym exists in a body to be processed + -- later if inlining is enabled. if Present (Enclosing_Child) then Install_Siblings (Enclosing_Child, L); + Scope_Stack.Table (Scope_Stack.Last).Previous_Visibility := + False; end if; Push_Scope (Scop);