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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.199.67 with SMTP id ji3mr615382pac.17.1441641767024; Mon, 07 Sep 2015 09:02:47 -0700 (PDT) X-Received: by 10.182.105.230 with SMTP id gp6mr81747obb.12.1441641766756; Mon, 07 Sep 2015 09:02:46 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!kq10no1926414igb.0!news-out.google.com!nt1ni3639igb.0!nntp.google.com!kq10no1444822igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 7 Sep 2015 09:02:46 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.138.39.55; posting-account=IcHmbgoAAABVfpbjrkJyy4Yb3hmce3tn NNTP-Posting-Host: 194.138.39.55 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <56274cb4-21f3-479b-9515-1c15c8b650aa@googlegroups.com> Subject: Re: Addressing in Object Ada v/s GNAT (2013) showing Vast Differences From: Lucas Redding Injection-Date: Mon, 07 Sep 2015 16:02:46 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3769 X-Received-Body-CRC: 3213412524 Xref: news.eternal-september.org comp.lang.ada:27730 Date: 2015-09-07T09:02:46-07:00 List-Id: On Monday, September 7, 2015 at 3:04:43 PM UTC+1, G.B. wrote: > On 07.09.15 13:54, Lucas Redding wrote: > > On Monday, September 7, 2015 at 12:39:35 PM UTC+1, Lucas Redding wrote: > >> Hi > >> > >> I was wondering how the addressing mechanism works in GNAT Ada? Is it = so vastly different to Object Ada? Is there a way I can tailor the GNAT add= ressing mechanism to follow that of Object Ada? > >> > >> I have a program that runs perfectly in Object Ada. The program relies= heavily on "USE AT" clauses together with 'SIZE on underlying type definit= ion. This is in order to map directly and deterministically to memory with = bit precision. The data is independently produced so this is very important= . > >> > >> I have compiled the program is GNAT Ada but I am getting run time erro= rs such as "misaligned address value". More worryingly, any data read from = memory that relies on the addressing mechanisms described above is incohere= nt. > >> > >> I am interested in moving to GNAT Ada because I believe the accompanyi= ng toolset is much richer and therefore more productive but I am beginning = to wonder whether this is too onerous task? > >> > >> Any help is greatly appreciated. > >> > >> Lucas > > > > Hi, > > > > I forgot to say that platform is Windows 7 (64 bit if that matters) and= the data is in S_RECORD format (With correct ENDIANISM). > > > > Any help is greatly appreciated. >=20 > In case you haven't already found it, a look at GNAT > chosen representation is possible when translating > with the -gnatR?[s] options. I also assume you have > been specifying alignment of types/objects? Maybe > also including fields for padding? Hi GB Yes I have included alignment of types and objects. I have not explicitly s= pecified the padding gaps. In object Ada, this is not necessary provided th= e type specifications are explicitly size constrained and the object fits i= n between its address and the next objects address. In other words if there= is a gap between the end of one object and the beginning of the next objec= t, the data is read correctly (if the size of the type is explicitly constr= ained).=20 Many thanks for that pointerto the -gnatR option. Being a novice to the com= piler there are so many options to get to grips with. I am also using GPS, = and toggling all the tick boxes did not produce this switch. I am off to the GNAT RM to read about this switch, and will report back. Thanks again Lucas