comp.lang.ada
 help / color / mirror / Atom feed
* OA bug ?
@ 1999-06-21  0:00 Vladimir Olensky
  1999-06-21  0:00 ` Tucker Taft
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Olensky @ 1999-06-21  0:00 UTC (permalink / 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







^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-06-23  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-21  0:00 OA bug ? Vladimir Olensky
1999-06-21  0:00 ` Tucker Taft
1999-06-22  0:00   ` Another OA bug ? (was Re: OA bug ?) czgrr
1999-06-23  0:00     ` Tucker Taft

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