comp.lang.ada
 help / color / mirror / Atom feed
From: Vadim Godunko <vgodunko@gmail.com>
Subject: Re: Access type (mis)use (Was: Bug in Ada (SuSe 10.2) ?)
Date: Thu, 21 Feb 2008 13:57:18 -0800 (PST)
Date: 2008-02-21T13:57:18-08:00	[thread overview]
Message-ID: <6d007932-b0af-4f9f-8dc9-f88073edc26a@72g2000hsu.googlegroups.com> (raw)
In-Reply-To: Sskvj.16399$k_4.3269@trnddc04

On 21 фев, 22:40, "Bob Klungle" <bklung...@verizon.net> wrote:
> "Jacob Sparre Andersen" <spa...@nbi.dk> wrote in messagenews:ygefxvmv6ir.fsf_-_@hugsarin.dmusyd.edu...
>
>
>
> > billjones6...@yahoo.com writes:
>
> >> What should this print?
>
> >> with Ada.Text_IO;
> >> procedure Dangling_Pointer is
> >>    type Int_Access is access all integer;
>
> >>    Save : Int_Access;
>
> >>    type AirSpeed is record
> >>       Altitude : aliased integer := 9;
> >>    end record;
>
> >>    type AoA (Rudder: access AirSpeed) is limited null record;
>
> >>    function WoW (Slats: access AirSpeed) return Int_Access is
> >>    begin
> >>       return Slats.Altitude'Access;
> >>    end;
>
> >>    procedure Calculate is
> >>       Fuel: aliased AirSpeed;
> >>       Heading: AoA (Fuel'Access);
> >>    begin
> >>       Save := WoW (Heading.Rudder);
>
> > I would expect the above line to give a compile time error.  If it
> > doesn't: Why?
>
> For what it is worth, cygwin gnatmake 3.4.4 yields
> 9
> 11
>

Where are no problem at this place. Program_Error must be raised
inside the Wow subprogram. Actual accessibility level of the object
passed in Slats is deeper when Int_Access type.

So, this is not a leak in the standard this is just a bug in the
concrete compiler.



  parent reply	other threads:[~2008-02-21 21:57 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19  8:47 Bug in Ada (SuSe 10.2) ? Reinert Korsnes
2008-02-19  9:08 ` Niklas Holsti
2008-02-19  9:53   ` Reinert Korsnes
2008-02-19 11:21     ` Ludovic Brenta
2008-02-20 12:41       ` Reinert Korsnes
2008-02-20 16:50         ` Adam Beneschan
2008-02-20 18:31           ` Jeffrey R. Carter
2008-02-20 23:10             ` Adam Beneschan
2008-02-20 23:22             ` Adam Beneschan
2008-02-21  0:31               ` Randy Brukardt
2008-02-21  8:56                 ` Jean-Pierre Rosen
2008-02-21  9:08                   ` Alex R. Mosteo
2008-02-21  9:27                     ` Ludovic Brenta
2008-02-21  9:46                       ` billjones6789
2008-02-21 12:27                         ` Access type (mis)use (Was: Bug in Ada (SuSe 10.2) ?) Jacob Sparre Andersen
2008-02-21 19:40                           ` Bob Klungle
2008-02-21 21:25                             ` Jeffrey R. Carter
2008-02-21 21:57                             ` Vadim Godunko [this message]
2008-02-21 22:32                         ` Bug in Ada (SuSe 10.2) ? Randy Brukardt
2008-02-22 16:10                           ` billjones6789
2008-02-22 19:21                             ` Georg Bauhaus
2008-02-22 21:29                               ` Vadim Godunko
2008-02-22 21:39                                 ` Robert A Duff
2008-02-23 10:16                               ` billjones6789
2008-02-22 19:52                             ` Randy Brukardt
2008-02-23 10:36                               ` billjones6789
2008-02-26  0:32                                 ` Randy Brukardt
2008-02-26 16:46                                   ` billjones6789
2008-02-26 20:53                                     ` Randy Brukardt
2008-02-27  1:05                                     ` Robert A Duff
2008-02-27 10:06                                       ` billjones6789
2008-02-27 17:49                                         ` Robert A Duff
2008-02-28  0:30                                           ` Randy Brukardt
2008-02-28 15:33                                             ` Robert A Duff
2008-03-06 17:46                                             ` Adam Beneschan
2008-02-21  0:31               ` Jeffrey R. Carter
2008-02-21  0:35                 ` Jeffrey R. Carter
2008-03-06 11:55                   ` Colin Paul Gloster
2008-02-21  0:55               ` tmoran
2008-02-21  8:08                 ` billjones6789
2008-02-21  9:11                 ` Alex R. Mosteo
2008-02-21 23:01                   ` Randy Brukardt
2008-02-22 16:43                 ` Adam Beneschan
2008-02-22  9:06               ` Stephen Leake
2008-02-22  5:40       ` Gautier
replies disabled

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