From b09a237ab879a169416c3be1af8a773e982fd53a Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Tue, 31 Jul 2018 09:55:26 +0000 Subject: [Ada] Fix a freezing issue 2018-07-31 Javier Miranda gcc/ada/ * sem.ads (Inside_Preanalysis_Without_Freezing): New global counter. * sem.adb (Semantics): This subprogram has now the responsibility of resetting the counter before analyzing a unit, and restoring its previous value before returning. * freeze.adb (Freeze_Entity): Do not freeze if we are preanalyzing without freezing. * sem_res.adb (Preanalyze_And_Resolve): Set & restore In_Preanalysis_Without_Freezing. From-SVN: r263091 --- gcc/ada/sem.adb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/ada/sem.adb') diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index 799d66d..2415ef8 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -1447,9 +1447,18 @@ package body Sem is -- unit. All with'ed units are analyzed with config restrictions reset -- and we need to restore these saved values at the end. + Save_Preanalysis_Counter : constant Nat := + Inside_Preanalysis_Without_Freezing; + -- Saves the preanalysis nesting-level counter; required since we may + -- need to analyze a unit as a consequence of the preanalysis of an + -- expression without freezing (and the loaded unit must be fully + -- analyzed). + -- Start of processing for Semantics begin + Inside_Preanalysis_Without_Freezing := 0; + if Debug_Unit_Walk then if Already_Analyzed then Write_Str ("(done)"); @@ -1622,6 +1631,8 @@ package body Sem is Unit (Comp_Unit), Prefix => "<-- "); end if; + + Inside_Preanalysis_Without_Freezing := Save_Preanalysis_Counter; end Semantics; -------- -- cgit v1.1