diff options
author | Ed Schonberg <schonberg@adacore.com> | 2018-06-11 09:17:24 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-06-11 09:17:24 +0000 |
commit | 345bb755ae64b123f1cd5df9ed9b1be4f44c6f39 (patch) | |
tree | 55a17b83e03db422f29bbba9ab42770755703944 /gcc | |
parent | 81b6ae1eabba39429cf94dbdae86614aafa7b960 (diff) | |
download | gcc-345bb755ae64b123f1cd5df9ed9b1be4f44c6f39.zip gcc-345bb755ae64b123f1cd5df9ed9b1be4f44c6f39.tar.gz gcc-345bb755ae64b123f1cd5df9ed9b1be4f44c6f39.tar.bz2 |
[Ada] Unnesting: fix handling of stubs
2018-06-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_unst.adb (Search_Subprograms): Handle explicitly stubs at the top
level of a compilation unit, becuase they may contain nested
subprograms that need an activation record.
From-SVN: r261405
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/exp_unst.adb | 26 |
2 files changed, 24 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 53934c4..401c5d2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-06-11 Ed Schonberg <schonberg@adacore.com> + + * exp_unst.adb (Search_Subprograms): Handle explicitly stubs at the top + level of a compilation unit, becuase they may contain nested + subprograms that need an activation record. + 2018-06-11 Arnaud Charlet <charlet@adacore.com> * Makefile.rtl: Compile Ada files with $(ADAC) instead of $(CC). diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index 3899de3..9ad43f4 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -937,7 +937,8 @@ package body Exp_Unst is return Skip; end if; - -- Otherwise record an uplevel reference + -- Otherwise record an uplevel reference in a local + -- identifier. when others => if Nkind (N) in N_Has_Entity @@ -1727,6 +1728,7 @@ package body Exp_Unst is New_Occurrence_Of (Ent, Loc), Attribute_Name => Name_Address)); + -- or else 'Access for unconstrained Insert_After (Ins, Asn); -- Analyze the assignment statement. We do @@ -2072,6 +2074,13 @@ package body Exp_Unst is -- Tree visitor that search for outer level procedures with nested -- subprograms and invokes Unnest_Subprogram() + --------------- + -- Do_Search -- + --------------- + + procedure Do_Search is new Traverse_Proc (Search_Subprograms); + -- Subtree visitor instantiation + ------------------------ -- Search_Subprograms -- ------------------------ @@ -2095,15 +2104,16 @@ package body Exp_Unst is end; end if; - return OK; - end Search_Subprograms; + -- The proper body of a stub may contain nested subprograms, + -- and therefore must be visited explicitly. Nested stubs are + -- examined recursively in Visit_Node. - --------------- - -- Do_Search -- - --------------- + if Nkind (N) in N_Body_Stub then + Do_Search (Library_Unit (N)); + end if; - procedure Do_Search is new Traverse_Proc (Search_Subprograms); - -- Subtree visitor instantiation + return OK; + end Search_Subprograms; -- Start of processing for Unnest_Subprograms |