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 08:45:58 -0600 Date: Sat, 01 Apr 2006 09:33:33 -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: 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-08NUIHvrkBoykVN1CZHJZieZ64Vl7m4m6sOirzkcHCp5ar+RMybLIQ314BhgsP1gM/aph72bWmo+B6m!cHgziubT0ZxYBjmaGq1CeJBTbq3AIHAB/Vqx81S4jgMQu3OKf/U3NhFtSW+UkZVcI3ySodm1VMOZ!DDw= 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:3695 Date: 2006-04-01T09:33:33-05:00 List-Id: Doobs wrote: > 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. However on a project > where external test equipment showed that the contents of X were NOT the > same as Y I investigated further. I checked on both a Windows host version > of GCC (3.4.2) and a target cross compiler (GCC 3.4.4) and on both the > construct above is actually implemented using indirection (a pointer). The > map file and symbol table show that irrespective of the data type and size > of Y it is always implemented as a pointer to X. Although this appears > semantially identical to an overlay as far as the progam is concerned it is > NOT identical as far as an external observer is concerned. I have a bit > packed record which I wanted to return as an array of longwords to pretty > dumb test equipment. The easiest way *would* be to overlay a longword > array - however this would not appear to be possible..... > > > Try applying pragma volatile to both declarations. Also for completeness you should add a pragma import to Y to avoid any default initialization. There is an AI that talks (to some exent) to this issue. I am not entirely sure that the volatile will fix your problem because I don't quite get what the resulting behaviour is that you are seeing/not seeing.