Bug 86391 - Cannot pass array as aliased formal parameter
Summary: Cannot pass array as aliased formal parameter
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 6.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-03 14:23 UTC by Luke A. Guest
Modified: 2023-05-11 17:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke A. Guest 2018-07-03 14:23:36 UTC
When passing an initialised array as an aliased formal, the compiler complains:

mem.adb:13:11: untagged actual does not match aliased formal "B"

Source:

procedure Mem is
   type IA is array (Positive range <>) of Integer;

   type IA_Ptr is access all IA;

   procedure Inner (B : aliased in out IA) is null;

   --  S : aliased IA (1 .. 10) := (others => 0);       --  This does not work for some reason??
   --  S : aliased IA (1 .. 10) := (1 .. 10 => 0);      --  This does not work for some reason??
   --  S : aliased IA           := (1 .. 10 => 0);      --  This works.
   --  S : aliased IA           := (0, 1, 2, 3, 4, 5);  --  This works.
begin
   Inner (S);
end Mem;
Comment 1 Eric Botcazou 2023-05-11 17:02:42 UTC
Static subtype matching is required between formal and actual.