TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Date:
Mon, 10 May 1999 21:07:01 +0200
Reply-To:
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
7bit
Content-Type:
text/plain; charset="us-ascii"
Organization:
CelsiusTech
From:
Daniel Wengelin <[log in to unmask]>
Parts/Attachments:
text/plain (61 lines)
Please, could anyone see the probably obvious
reason why this should terminate with Program_Error.
It's basically "from the book" but I got some odd results.
It compiles without any warnings, see below.

E:\dawe\CELSIUS\STRICS\Ada95-kurs>gnatmake e1-main.adb
gcc -c e1-main.adb
gcc -c e1.ads
gcc -c e1-car.ads
gcc -c e1-vehicle.adb
gnatbind -x e1-main.ali
gnatlink e1-main.ali

E:\dawe\CELSIUS\STRICS\Ada95-kurs>e1-main

raised PROGRAM_ERROR : EXCEPTION_ACCESS_VIOLATION

E:\dawe\CELSIUS\STRICS\Ada95-kurs>

------------------------------------short source follows-----------------------------------
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package E1.Vehicle is
   type Object is tagged
      record
         Name:Unbounded_String;
      end record;
   procedure Swap (L,R : in out Object);
end E1.Vehicle;

package body E1.Vehicle is
   procedure Swap (L, R : in out Object)
   is
      Temp: Object;
   begin
      Temp:=L;
      L := R;
      R := Temp;
   end Swap;
end E1.Vehicle;

with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with E1.Vehicle;
package E1.Car is
   type Object is new E1.Vehicle.Object with
      record
         Registration : Unbounded_String;
      end record;
end E1.Car;

with Ada.Strings.Unbounded;use Ada.Strings.Unbounded;
with E1.Car;
procedure E1.Main is
   A_Car, Another_Car : E1.Car.Object;
begin
   A_Car := (To_Unbounded_String("putte"),
             To_Unbounded_String("abc123"));
   Another_Car := (To_Unbounded_String("pelle"),
                   To_Unbounded_String("gef789"));
   E1.CAR.Swap (A_Car ,Another_Car);
end E1.Main;

ATOM RSS1 RSS2