This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] Out parameters of a null-excluding access type in entries.


Hi Arnaud,

On 29/07/14 16:02, Arnaud Charlet wrote:
If a procedure or entry has an formal out-parameter of a null-excluding access
type, there is no check applied to the actual before the call. This patch
removes a spurious access check on such parameters on entry calls.

Compiling and executing p.adb must yield;

     Procedure version did not raise exception
     Entry version did not raise exception

---
with Ada.Text_IO; use Ada.Text_IO;
procedure P is
    type Integer_Access is access all Integer;

    An_Integer : aliased Integer;

    procedure Procedure_Version (A : out not null Integer_Access) is
    begin
       A := An_Integer'Access;
    end Procedure_Version;

    protected Object is
       entry Entry_Version (A : out not null Integer_Access);
    end Object;

    protected body Object is
       entry Entry_Version (A : out not null Integer_Access) when True is
          Junk : integer := 0;

this variable "Junk" seems useless.

       begin
          A := An_Integer'Access;
       end Entry_Version;
    end Object;

    A : Integer_Access;
begin
    A := null;
    Procedure_Version (A);
    Put_Line ("Procedure version did not raise exception");

    A := null;
    Object.Entry_Version (A);
    Put_Line ("Entry version did not raise exception");
end;

Ciao, Duncan.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]