comp.lang.ada
 help / color / mirror / Atom feed
From: "Michael B." <michaelb@example.com>
Subject: Accessibility and possible Gnat bug
Date: Fri, 19 Dec 2014 16:35:38 +0100
Date: 2014-12-19T16:35:38+01:00	[thread overview]
Message-ID: <m71gk7$5es$1@speranza.aioe.org> (raw)

In the previous discussion about accessibility I was pointed to the 
paper "Accessibility rules OK!" of John Barnes (ACM SIGAda Ada Letters 
Volume XV Issue 1, Jan./Feb. 1995) which contains the following example:

procedure Example6  is
    type T is new Integer;

    procedure P1(XP1 : access T) is
       type A is access all T;
       Ptr: A := null;

       procedure P2(XP2: access T) is
       begin
          Ptr := A(XP2);
       end P2;

    begin
       P2(XP1);
    end P1;

    X : aliased T;

begin
    declare
       Y : aliased T;
     begin
       declare
          Z : aliased T;
        begin
          P1(X'Access);
          P1(Y'Access);
          P1(Z'Access);   -- Raises Program_Error.
        end;
     end;
end Example6;

In the paper the program is expected to run without errors.
I compiled it with Gnat 4.9 on Debian 8.0, ran it and got an 
Program_Error on the marked line.

Is this correct in Ada 2012 or not? I would like to hear your opinion 
about that before I write a possibly unnecessary bug report to AdaCore.

Regards,

Michael


             reply	other threads:[~2014-12-19 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 15:35 Michael B. [this message]
2014-12-19 17:34 ` Accessibility and possible Gnat bug Tero Koskinen
2014-12-20 14:17   ` Michael B.
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox