From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,afb4d45672b1e262 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!news.musoftware.de!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Any way of persuading GNAT/GCC to implement a true overlay and not a pointer? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <87odzl5ilt.fsf@mid.deneb.enyo.de> Date: Sat, 1 Apr 2006 22:57:45 +0200 Message-ID: <61q7tttfz7ii.e40mbthf2hju.dlg@40tude.net> NNTP-Posting-Date: 01 Apr 2006 22:57:40 MEST NNTP-Posting-Host: 1ad041ad.newsread2.arcor-online.net X-Trace: DXC=HC6T@LRPG402j7j^L?86D8Q5U85hF6f;4jW\KbG]kaM8DAHcn;Zl5e8bYC;n;e14N8[6LHn;2LCV>[ On Sat, 1 Apr 2006 19:19:48 +0100, Doobs wrote: > "Doobs" wrote in message > news:SdmdndA2Z9jbI7PZnZ2dnUVZ8qWdnZ2d@pipex.net... >> >> "Florian Weimer" wrote in message >> news:87odzl5ilt.fsf@mid.deneb.enyo.de... >>>> I was under the impression that code of the following form : >>>> >>>> X : ; >>>> Y : ; >>>> 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