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.140.135.5 with SMTP id 5mr14390031qhh.11.1441699245776; Tue, 08 Sep 2015 01:00:45 -0700 (PDT) X-Received: by 10.182.199.37 with SMTP id jh5mr92942obc.6.1441699245744; Tue, 08 Sep 2015 01:00:45 -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!z77no1523531qge.1!news-out.google.com!f6ni4469igi.0!nntp.google.com!kq10no2219891igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 8 Sep 2015 01:00:45 -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: Tue, 08 Sep 2015 08:00:45 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:27741 Date: 2015-09-08T01:00:45-07:00 List-Id: On Monday, September 7, 2015 at 10:02:37 PM UTC+1, Niklas Holsti wrote: > On 15-09-07 14:54 , Lucas Redding wrote: > > On Monday, September 7, 2015 at 12:39:35 PM UTC+1, Lucas Redding > > wrote: > >> Hi > ... > >> I have a program that runs perfectly in Object Ada. The program > >> relies heavily 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. > >> > >> 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 memory that relies on the addressing mechanisms > >> described above is incoherent. > ... > > 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). > > That sounds a bit confusing; S-record format is an ASCII (hex) text > file. You probably mean that you read the S-record data and convert from > ASCII hex to an octet array, octet per octet, and then you access that > octet array using the "use at" mechanism. > > I'm not surprised that you get errors -- this sounds very unportable to > me (because of the "use at"). I understand that you have an existing > program that you want to port, preferably without a lot of changes, but > is it really worthwhile to port it from its old unportable form into a > new and different unportable form? > > For this problem, I would use the Ada Stream feature, either to read the > S-record text directly into my data structure (i.e. the variables for > which you use "use at", but which I would fill with Stream Read), or by > converting the ASCII S-records into an octet array, and then viewing > that octet array as an indexable in-memory Stream and using Stream Read > to access the data objects within the octet array. > > Just a suggestion, of course. > > -- > Niklas Holsti > Tidorum Ltd > niklas holsti tidorum fi > . @ . Thanks Niklas, That is indeed what we are already doing, re converting the SRECORD hex into octets and then mapping the stream to memory. LR