]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Crash on compilation unit instance
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 May 2018 13:04:24 +0000 (13:04 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 24 May 2018 13:04:24 +0000 (13:04 +0000)
commitb9996bcee2b0fe0863788eb7a2073f1c357d2fed
treec89008dcaf0bbb3973a888a86bc8f877ba4baf12
parentd166d8b7274b6996382c9b78093814ab0b0b4f88
[Ada] Crash on compilation unit instance

Do not generate a variable marker for a reference which appears within the
formal part of an instantiation which acts as a compilation unit because
there is no suitable insertion context.

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

--  gnat.adc

pragma SPARK_Mode (On);

--  gen.ads

generic
   Val_1 : Integer;
   Val_2 : Integer;
package Gen is
end Gen;

--  pack.ads

package Pack is
   Val : Integer := 123;

   function Get_Val return Integer;
end Pack;

--  inst.ads

with Gen;
with Pack; use Pack;

package Inst is new Gen (Val, Get_Val);

--  proc.adb

with Pack; use Pack;

procedure Proc (Val_1 : Integer := Val; Val_2 : Integer := Get_Val) is
begin null; end Proc;

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

$ gcc -c inst.ads
$ gcc -c inst.ads -gnatd.F
$ gcc -c proc.adb
$ gcc -c proc.adb -gnatd.F

2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* sem_elab.adb (Build_Variable_Reference_Marker): Do not create a
variable marker when the reference appears in the formal part of a
compilation unit instance because there is no place to insert it.
(In_Compilation_Instance_Formal_Part): New routine.

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