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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 01 Apr 2006 14:01:43 -0600 Date: Sat, 01 Apr 2006 15:01:14 -0500 From: Jeffrey Creem User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Any way of persuading GNAT/GCC to implement a true overlay and not a pointer? References: <87odzl5ilt.fsf@mid.deneb.enyo.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.74.171 X-Trace: sv3-NzX2pfPoSsNTQoRkNrGijpncBkmnn8Igb6QvOtPh9hmbEte9LM86WdDdNYODvWDSenk2Jc7+kvu2Xtw!zk78b5o5MhiAayJLWfDcVM9jnImELM3qIjZxTAjj74gSSDWubQhySTBAb+CYeFH33Q8EDPJrN6Tl!N24= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:3703 Date: 2006-04-01T15:01:14-05:00 List-Id: 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. > > Try this. 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); Pragma Export(Ada, Myx, "MyX"); myY : MyArrayType; pragma Volatile(Myy); pragma Import(Ada, Myy, "MyX"); end TestPackage; Not sure exactly what your end desired result is but assuming you really need to do this then perhaps this works.