comp.lang.ada
 help / color / mirror / Atom feed
From: "Vladimir Olensky" <vladimir_olensky@yahoo.com>
Subject: OA bug ?
Date: 1999/06/21
Date: 1999-06-21T00:00:00+00:00	[thread overview]
Message-ID: <929984465.815.34@news.remarQ.com> (raw)


Here is small piece of code to illustrate the  problem :

=================================
with Ada.Finalization;

package T_Ctld is
 type T is  new  Ada.Finalization.Controlled  with private;
  type T_A is  access all T;
  type T_CA is  access all T'Class;

private
  type T is new Ada.Finalization.Controlled  with null  record;

end T_Ctld;

------------------------
with T_Ctld;  Use T_Ctld;
procedure Tst_Ctld_bug is

   Ptr1: T_CA;
begin
   null;

end Tst_Ctld_bug;

----------------------------
OA compiles everything with no problem.
At a link time it gives an error:
  t_ctld.obj : error LNK2005: t_ctld.t__acc_cleanup already defined in
t_ctld.obj  tst_ctld_bug.exe : fatal error LNK1169: one or more multiply
defined symbols found
-------------------------

Examination of T_Ctld assembler listing gives the following:

                     ;Listing of uninitialized data section   ;
                     ;                                        ;
 000000              t_ctld.t__acc_cleanup DB 32 DUP(?)       ;
 000020              t_ctld.t__acc_cleanup DB 32 DUP(?)       ;

and this explains the above problem
-----
 000000  corresponds to T_CA;
 000020  corresponds to T_A;

==============================

Changing T_ctld fixes the problem:

with Ada.Finalization;

package T_Ctld is
 type T is  new  Ada.Finalization.Controlled  with null record;
  type T_A is  access all T;
  type T_CA is  access all T'Class;

end T_Ctld;
-----------------------------
the same  piece of assembler listing:

                      ;Listing of uninitialized data section   ;
                      ;                                        ;
 000000               t_ctld.t_ca__acc_cleanup DB 32 DUP(?)    ;
 000020               t_ctld.t_a__acc_cleanup DB 32 DUP(?)     ;

Here everything is OK and as a result there are no problems
building Tst_Ctld_bug.
=========================================


So it looks as OA special edition has some problems with
 internal data representation for controlled types
 with private part.

With GNAT everything is OK.


Any comments ?

Regards.

Vladimir Olensky







             reply	other threads:[~1999-06-21  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-21  0:00 Vladimir Olensky [this message]
1999-06-21  0:00 ` OA bug ? Tucker Taft
1999-06-22  0:00   ` Another OA bug ? (was Re: OA bug ?) czgrr
1999-06-23  0:00     ` Tucker Taft
replies disabled

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