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.31.3.93 with SMTP id 90mr615815vkd.0.1441882074919; Thu, 10 Sep 2015 03:47:54 -0700 (PDT) X-Received: by 10.182.60.130 with SMTP id h2mr164948obr.28.1441882074879; Thu, 10 Sep 2015 03:47:54 -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!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!z77no92911qge.1!news-out.google.com!nt1ni6286igb.0!nntp.google.com!kq10no2649270igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 10 Sep 2015 03:47:54 -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: Subject: Re: Addressing in Object Ada v/s GNAT (2013) showing Vast Differences From: Lucas Redding Injection-Date: Thu, 10 Sep 2015 10:47:54 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3367 X-Received-Body-CRC: 1345480504 Xref: news.eternal-september.org comp.lang.ada:27758 Date: 2015-09-10T03:47:54-07:00 List-Id: On Monday, September 7, 2015 at 12:39:35 PM UTC+1, Lucas Redding wrote: > Hi >=20 > 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 addres= sing mechanism to follow that of Object Ada? >=20 > I have a program that runs perfectly in Object Ada. The program relies he= avily on "USE AT" clauses together with 'SIZE on underlying type definition= . This is in order to map directly and deterministically to memory with bit= precision. The data is independently produced so this is very important. >=20 > I have compiled the program is GNAT Ada but I am getting run time errors = such as "misaligned address value". More worryingly, any data read from mem= ory that relies on the addressing mechanisms described above is incoherent. >=20 > I am interested in moving to GNAT Ada because I believe the accompanying = toolset is much richer and therefore more productive but I am beginning to = wonder whether this is too onerous task? >=20 > Any help is greatly appreciated. >=20 > Lucas Thanks Everybody. Although I still have not completely resolved the issue, by analysing the o= utput from -gnatR I can see the issue is with the alignment of underlying t= ype and object specifications. The original code has no alignment clauses a= t all.=20 We know that all the objects (memory input to the application) are mapped t= o memory so that everything is aligned at 1.=20 I deduce that this means that OA by default aligns objects to 1 since the o= bjects are being read without any alignment clauses.=20 On the other hand, GNAT aligns each object to a boundary of a power of 2 an= d adjusts this based on the component size. Here lies the issue. I need to change the alignment of each underlying type mapped into memory. = I am hoping the combination of explicit alignments and precise rep clauses = (size etc.) should make the code portable between compilers. Fingers crossed while I go and do the work and will report back when I fini= sh (or if I get stuck). Many thanks for all your help. Much appreciated. Lucas