comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Any way of persuading GNAT/GCC to implement a true overlay and not a pointer?
Date: Sat, 1 Apr 2006 22:57:45 +0200
Date: 2006-04-01T22:57:40+02:00	[thread overview]
Message-ID: <61q7tttfz7ii.e40mbthf2hju.dlg@40tude.net> (raw)
In-Reply-To: I-CdncDukPveWbPZRVnyiw@pipex.net

On Sat, 1 Apr 2006 19:19:48 +0100, Doobs wrote:

> "Doobs" <doobs@doobs.com> wrote in message 
> news:SdmdndA2Z9jbI7PZnZ2dnUVZ8qWdnZ2d@pipex.net...
>>
>> "Florian Weimer" <fw@deneb.enyo.de> wrote in message 
>> news:87odzl5ilt.fsf@mid.deneb.enyo.de...
>>>> I was under the impression that code of the following form :
>>>>
>>>> X : <Some Type>;
>>>> Y : <Some Type>;
>>>> for Y'Address use X'Address;
>>>>
>>>> would result in an overlay in the resulting code.
>>>
>>> Could you show some more code?  Probably initialization is causing
>>> your problems, which can be fixed with a pragma Import.
>>
>> The following is an example of the problem:
>>
>> package TestPackage
>> is
>>
>>   type MyRecordType is
>>   record
>>      element1 : Positive;
>>      element2 : Positive;
>>   end record;
>>
>>   type MyArrayType is array(1..2) of Positive;
>>
>>   myX : MyRecordType;
>>   pragma volatile(myX);
>>   myY : MyArrayType;
>>   pragma volatile(myY);
>>   for myY'Address use myX'Address;
>>
>>
>> end TestPackage;
>>
>> The following fragments of the resulting MAP file (GCC 3.4.2 mingw32) show 
>> the problem...
>>
>> .data          0x00472b00       0x10 ./testpackage.o
>>                0x00472b00                testpackage__myy
>> .data          0x00472b10       0x10 ./nextpackage.o
>>
>> <..... later in the file...>
>>
>> COMMON         0x004a2770       0x20 ./testpackage.o
>>                0x004a2770                testpackage__myx
>>                0x004a2780                testpackage_E
>>
>>
>> Clearly myX and myY do NOT share the same address.  I am also puzzled as 
>> to why the variables have been put in differen memory sections...
>>
> Note that including a pragma import did NOT solve the problem - the code 
> looked like this
> 
>    myX : MyRecordType;
>    pragma volatile(myX);
>    myY : MyArrayType;
>    pragma volatile(myY);
>    for myY'Address use myX'Address;
>    pragma Import (Ada, myY);
> 
> But the map file exhibited the same problem as before.

Hmm, with gnat 3.15p for Windows (no any pragmas) it gives:

    0x00414848                testpackage__myy
    0x0041484c                testpackage__myx

which seems to be fine, assuming MyY's dope. Both

   MyX.element1'Address = MyY (1)'Address
   MyX.element2'Address = MyY (2)'Address

evaluate true.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  parent reply	other threads:[~2006-04-01 20:57 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-01 13:47 Any way of persuading GNAT/GCC to implement a true overlay and not a pointer? Doobs
2006-04-01 14:33 ` Jeffrey Creem
2006-04-01 16:52   ` Doobs
2006-04-01 17:56     ` Martin Krischik
2006-04-01 18:04     ` Dmitry A. Kazakov
2006-04-01 17:08 ` Florian Weimer
2006-04-01 17:54   ` Doobs
2006-04-01 18:19     ` Doobs
2006-04-01 20:01       ` Jeffrey Creem
2006-04-01 21:33         ` Doobs
2006-04-03 12:25           ` Gerd
2006-04-01 20:57       ` Dmitry A. Kazakov [this message]
2006-04-04  1:23 ` Randy Brukardt
2006-04-10  1:42   ` Justin Gombos
2006-04-10 20:12     ` Randy Brukardt
2006-04-11 13:54       ` Making money on open source, if not by selling _support_, then how? Marc A. Criley
2006-04-11 15:13         ` Justin Gombos
2006-04-11 16:22           ` Dmitry A. Kazakov
2006-04-11 17:56             ` Justin Gombos
2006-04-11 18:38               ` Georg Bauhaus
2006-04-12 13:59                 ` Justin Gombos
2006-04-12 14:39                   ` Georg Bauhaus
2006-04-15 19:33                     ` Justin Gombos
2006-04-12 17:07                   ` Larry Kilgallen
2006-04-13  3:16                     ` Justin Gombos
2006-04-11 19:59               ` Randy Brukardt
2006-04-11 20:18                 ` Ed Falis
2006-04-12 14:10                 ` Justin Gombos
2006-04-12 20:57                   ` Randy Brukardt
2006-04-15 20:37                     ` Justin Gombos
2006-04-18  0:24                       ` Randy Brukardt
2006-04-18 16:02                         ` Justin Gombos
2006-04-12 19:27                 ` Martin Dowie
2006-04-12  8:32               ` Dmitry A. Kazakov
2006-04-12 11:23                 ` Georg Bauhaus
2006-04-12 15:34                   ` Dmitry A. Kazakov
2006-04-12 17:11                     ` Georg Bauhaus
2006-04-12 19:37                       ` Dmitry A. Kazakov
2006-04-12 21:56                         ` Georg Bauhaus
2006-04-13  9:17                           ` Dmitry A. Kazakov
2006-04-13 14:18                             ` Georg Bauhaus
2006-04-14 10:01                               ` Dmitry A. Kazakov
2006-04-14 12:55                                 ` Georg Bauhaus
2006-04-15 10:13                                   ` Dmitry A. Kazakov
2006-04-15 18:07                                     ` Georg Bauhaus
2006-04-13  2:58                 ` Justin Gombos
2006-04-13  9:17                   ` Dmitry A. Kazakov
2006-04-15 21:17                     ` Justin Gombos
2006-04-16 10:53                       ` Dmitry A. Kazakov
2006-04-16 13:03                         ` Georg Bauhaus
2006-04-16 17:59                           ` Dmitry A. Kazakov
2006-04-16 20:53                             ` Georg Bauhaus
2006-04-17  9:16                               ` Dmitry A. Kazakov
2006-04-19 20:38                                 ` Justin Gombos
2006-04-20 18:01                                   ` Dmitry A. Kazakov
2006-04-18  0:29                             ` Randy Brukardt
2006-04-16 14:55                         ` Justin Gombos
2006-04-16 17:59                           ` Dmitry A. Kazakov
2006-04-19 18:17                             ` Justin Gombos
2006-04-20 18:07                               ` Dmitry A. Kazakov
2006-04-11 15:34         ` Justin Gombos
2006-04-12  2:59         ` Steve
2006-04-13  7:41         ` Jean-Pierre Rosen
2006-04-13 13:18           ` Marc A. Criley
2006-04-13 13:35             ` Dmitry A. Kazakov
2006-04-13 13:57             ` Making money on open source, if not by selling _support_, then Larry Kilgallen
2006-04-13 19:37               ` Justin Gombos
2006-04-13 21:02                 ` Larry Kilgallen
2006-04-14  2:49                   ` Justin Gombos
replies disabled

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