Commit 345bb755 by Ed Schonberg Committed by Pierre-Marie de Rodat

[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
parent 81b6ae1e
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> 2018-06-11 Arnaud Charlet <charlet@adacore.com>
* Makefile.rtl: Compile Ada files with $(ADAC) instead of $(CC). * Makefile.rtl: Compile Ada files with $(ADAC) instead of $(CC).
......
...@@ -937,7 +937,8 @@ package body Exp_Unst is ...@@ -937,7 +937,8 @@ package body Exp_Unst is
return Skip; return Skip;
end if; end if;
-- Otherwise record an uplevel reference -- Otherwise record an uplevel reference in a local
-- identifier.
when others => when others =>
if Nkind (N) in N_Has_Entity if Nkind (N) in N_Has_Entity
...@@ -1727,6 +1728,7 @@ package body Exp_Unst is ...@@ -1727,6 +1728,7 @@ package body Exp_Unst is
New_Occurrence_Of (Ent, Loc), New_Occurrence_Of (Ent, Loc),
Attribute_Name => Name_Address)); Attribute_Name => Name_Address));
-- or else 'Access for unconstrained
Insert_After (Ins, Asn); Insert_After (Ins, Asn);
-- Analyze the assignment statement. We do -- Analyze the assignment statement. We do
...@@ -2072,6 +2074,13 @@ package body Exp_Unst is ...@@ -2072,6 +2074,13 @@ package body Exp_Unst is
-- Tree visitor that search for outer level procedures with nested -- Tree visitor that search for outer level procedures with nested
-- subprograms and invokes Unnest_Subprogram() -- subprograms and invokes Unnest_Subprogram()
---------------
-- Do_Search --
---------------
procedure Do_Search is new Traverse_Proc (Search_Subprograms);
-- Subtree visitor instantiation
------------------------ ------------------------
-- Search_Subprograms -- -- Search_Subprograms --
------------------------ ------------------------
...@@ -2095,15 +2104,16 @@ package body Exp_Unst is ...@@ -2095,15 +2104,16 @@ package body Exp_Unst is
end; end;
end if; end if;
return OK; -- The proper body of a stub may contain nested subprograms,
end Search_Subprograms; -- and therefore must be visited explicitly. Nested stubs are
-- examined recursively in Visit_Node.
--------------- if Nkind (N) in N_Body_Stub then
-- Do_Search -- Do_Search (Library_Unit (N));
--------------- end if;
procedure Do_Search is new Traverse_Proc (Search_Subprograms); return OK;
-- Subtree visitor instantiation end Search_Subprograms;
-- Start of processing for Unnest_Subprograms -- Start of processing for Unnest_Subprograms
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment