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!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.pipex.net!news.pipex.net.POSTED!not-for-mail NNTP-Posting-Date: Sat, 01 Apr 2006 15:33:33 -0600 Reply-To: "Doobs" From: "Doobs" Newsgroups: comp.lang.ada References: <87odzl5ilt.fsf@mid.deneb.enyo.de> Subject: Re: Any way of persuading GNAT/GCC to implement a true overlay and not a pointer? Date: Sat, 1 Apr 2006 22:33:39 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Message-ID: NNTP-Posting-Host: 85.210.60.99 X-Trace: sv3-4VyYYzA1BPNdN84RjYZI0clFLgsO6iQVNQdUwQ+ToR39FHx/qgwL0yPL8zsFYbmGUdc1mzIFcYbFz/C!1nZmmoO/h2fiklWKrlVzZRMPOtPmH4+rJilQa4C5SamKWu+v8rZLhUIFvSa5VSH9hR11snDEcXXm!RR/fOtRfsA== X-Complaints-To: abuse@dsl.pipex.net X-DMCA-Complaints-To: abuse@dsl.pipex.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:3705 Date: 2006-04-01T22:33:39+01:00 List-Id: >>>>>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. Interestingly with this approach any reference to myY disappears from the Map file and debug symbol table. myY then ceases to be a useful symbol for debugging purposes external to the program (which was the original reason to have the overlay!).....