https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124376
Bug ID: 124376
Summary: 6.4.1(6.4/3) (aliased parameter accessibility) appears
to be unimplemented
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: liam at liampwll dot com
CC: dkm at gcc dot gnu.org
Target Milestone: ---
This was the result of me poking at GNAT rather than finding this in real code,
however I think this one deserves its own issue because it is quite trivial to
accidentally hit it in real code. This is not a regression unless it occurred
before GCC 8.
In short 6.4.1(6.4/3) states that "In a function call, the accessibility level
of the actual object for each explicitly aliased parameter shall not be
statically deeper than the accessibility level of the master of the call (see
3.10.2)." but in the below code that is clearly ignored. Refer to PR ada/124310
comment 10 for a full rundown of why the master of the call here is not the
assignment statement.
There is one mention of 6.4.1(6.4/3) in the source code but this is on an
entirely unrelated bit of code, see g:b3d18092b60c74ebabdb0cb596d4435b14859130.
procedure Example is
function F (R : aliased Integer) return access constant Integer
is (R'Access);
X : access constant Integer;
begin
declare
R : aliased Integer := 123;
begin
X := F (R);
end;
end Example;