* Accessibility and possible Gnat bug
@ 2014-12-19 15:35 Michael B.
2014-12-19 17:34 ` Tero Koskinen
0 siblings, 1 reply; 3+ messages in thread
From: Michael B. @ 2014-12-19 15:35 UTC (permalink / 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Accessibility and possible Gnat bug
2014-12-19 15:35 Accessibility and possible Gnat bug Michael B.
@ 2014-12-19 17:34 ` Tero Koskinen
2014-12-20 14:17 ` Michael B.
0 siblings, 1 reply; 3+ messages in thread
From: Tero Koskinen @ 2014-12-19 17:34 UTC (permalink / raw)
19.12.2014, 17:35, Michael B. kirjoitti:
> 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
...
> P1(Z'Access); -- Raises Program_Error.
...
> 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.
I don't know what the standard actually says, but Irvine ICCAda
generates executable, which does not raise exception when
the code is compiled in Ada 2005 mode.
Also, Janus/Ada generates executable, which does not raise exception,
when Janus/Ada uses Ada 95 mode.
GNAT GPL 2013 always generates executable, which raises exception.
(Tested with -gnat95 and -gnat2012 flags).
Yours,
Tero
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Accessibility and possible Gnat bug
2014-12-19 17:34 ` Tero Koskinen
@ 2014-12-20 14:17 ` Michael B.
0 siblings, 0 replies; 3+ messages in thread
From: Michael B. @ 2014-12-20 14:17 UTC (permalink / raw)
That's an empirical argument for the bug thesis.
Thank you for testing.
Regards,
Michael
On 12/19/14 18:34, Tero Koskinen wrote:
> I don't know what the standard actually says, but Irvine ICCAda
> generates executable, which does not raise exception when
> the code is compiled in Ada 2005 mode.
>
> Also, Janus/Ada generates executable, which does not raise exception,
> when Janus/Ada uses Ada 95 mode.
>
> GNAT GPL 2013 always generates executable, which raises exception.
> (Tested with -gnat95 and -gnat2012 flags).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-20 14:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-19 15:35 Accessibility and possible Gnat bug Michael B.
2014-12-19 17:34 ` Tero Koskinen
2014-12-20 14:17 ` Michael B.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox