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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Addressing in Object Ada v/s GNAT (2013) showing Vast Differences Date: Tue, 8 Sep 2015 00:02:34 +0300 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 2hkm12FtOVUjC+fPKeGy0A/EFljt48FR9CNQwaUHCHn6RWqpVd Cancel-Lock: sha1:+30IF3dPbnZ/5CVkUYbhSbuVh18= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:27736 Date: 2015-09-08T00:02:34+03:00 List-Id: 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 . @ .