]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Crash on nesting of subunits with bodies acting as specs
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Dec 2018 11:09:08 +0000 (11:09 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Dec 2018 11:09:08 +0000 (11:09 +0000)
commit236d875af89206f148036e349c92552621549c1b
treebd20601f62adac3c54b9fdd3c69f481b1f116eb3
parent4030d28e78966ca40681af7f235e8e061fa76db0
[Ada] Crash on nesting of subunits with bodies acting as specs

This patch corrects an issue whereby a set of nested subunits including
subprogram subunits acting as bodies would cause a crash when a child
subunit "withs" an ansestor in certain instances due to a mismanagment
of the scope stack.

------------
-- Source --
------------

--  w.ads

package W is
end;

--  w-b.ads

package W.B is
  pragma Elaborate_Body;
end;

--  w-b.adb

with W.B.C;

package body w.B is end;

--  w-b-c.adb

with W;
procedure W.B.C is
  package D is
    procedure E;
  end;
  package body D is separate;
begin
  null;
end;

--  w-b-c-d.adb

separate (W.B.C)
package body D is
  procedure E is separate;
end;

--  w-b-c-d-e.adb

with W;

separate (W.B.C.D)
procedure E is
begin
  null;
end;

-----------------
-- Compilation --
-----------------

$ gnatmake -q w-b.adb

2018-12-11  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* sem_ch10.adb (Analyze_Subunit): Modify conditional to fully
remove parent contexts from library-level subprogram bodies in
addition to package bodies.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266978 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ada/ChangeLog
gcc/ada/sem_ch10.adb