diff options
author | Ed Schonberg <schonberg@adacore.com> | 2019-12-12 10:02:47 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-12-12 10:02:47 +0000 |
commit | c9312e3079094e6255f7b5603475f7cd1cb517aa (patch) | |
tree | b65d42762a82435cc1443a79120be170f4c4c2e0 | |
parent | 4cd30bf7e5bff7a5d7c78b442d3658f4a95fc31a (diff) | |
download | gcc-c9312e3079094e6255f7b5603475f7cd1cb517aa.zip gcc-c9312e3079094e6255f7b5603475f7cd1cb517aa.tar.gz gcc-c9312e3079094e6255f7b5603475f7cd1cb517aa.tar.bz2 |
[Ada] Spurious visibility error on subunit with optimization
2019-12-12 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch10.adb (Analyze_Subunit): Fix spurious visibility error
on subunit with optimization.
From-SVN: r279291
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/sem_ch10.adb | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f911670..48448b2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-12-12 Ed Schonberg <schonberg@adacore.com> + + * sem_ch10.adb (Analyze_Subunit): Fix spurious visibility error + on subunit with optimization. + 2019-12-12 Arnaud Charlet <charlet@adacore.com> * raise-gcc.c (__gnat_personality_v0): Define for SEH. diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index c5d10f7..16f0807 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); |