]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] ICE during unnesting when nested subprograms have address taken
authorGary Dismukes <dismukes@adacore.com>
Thu, 19 Dec 2019 22:00:27 +0000 (17:00 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 2 Jun 2020 08:58:15 +0000 (04:58 -0400)
2020-06-02  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

* exp_unst.adb (Register_Subprogram): Test for Address_Taken (in
addition to the existing test for In_Synchonized_Unit) when
deciding whether to reset the Reachable flag on all subprograms
enclosing the subprogram being registered.

gcc/ada/exp_unst.adb

index 1460b641b19fb102fb3e8ee1129ed3e146b18865..b3ded138ee579756b2e7691e857066bb70fe15f9 100644 (file)
@@ -841,9 +841,13 @@ package body Exp_Unst is
 
                --  If we marked this reachable because it's in a synchronized
                --  unit, we have to mark all enclosing subprograms as reachable
-               --  as well.
+               --  as well. We do the same for subprograms with Address_Taken,
+               --  because otherwise we can run into problems with looking at
+               --  enclosing subprograms in Subps.Table due to their being
+               --  unreachable (the Subp_Index of unreachable subps is later
+               --  set to zero and their entry in Subps.Table is removed).
 
-               if In_Synchronized_Unit (E) then
+               if In_Synchronized_Unit (E) or else Address_Taken (E) then
                   declare
                      S : Entity_Id := E;