https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124226
Bug ID: 124226
Summary: Protected procedure access with implicit dereference
gets invalid address
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: ---
As you can see in the below code A and B should obviously be equal, but they
are not. B is pointing and some invalid address. There's a chance this code is
invalid too, I haven't checked exactly what the RM says about protected
procedure access.
pragma Ada_2022;
with Ada.Text_IO;
procedure Example is
protected type Fallback_Hit_Counter_Type is
procedure Handler;
end Fallback_Hit_Counter_Type;
protected body Fallback_Hit_Counter_Type is
procedure Handler is
begin
Ada.Text_IO.Put_Line ("Test");
end Handler;
end Fallback_Hit_Counter_Type;
Fallback_Hit_Counter : access Fallback_Hit_Counter_Type :=
new Fallback_Hit_Counter_Type;
type X is access protected procedure;
A : X := Fallback_Hit_Counter.all.Handler'Access;
B : X := Fallback_Hit_Counter.Handler'Access;
begin
Ada.Text_IO.Put_Line (A'Image);
Ada.Text_IO.Put_Line (B'Image);
A.all;
B.all;
end Example;