Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: gah4 Newsgroups: comp.compilers Subject: Re: C arithmetic, was Software proofs, was Are there different Date: Sat, 11 Feb 2023 00:01:33 -0800 (PST) Organization: Compilers Central Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-02-039@comp.compilers> References: <23-01-092@comp.compilers> <23-02-003@comp.compilers> <23-02-019@comp.compilers> <23-02-025@comp.compilers> <23-02-026@comp.compilers> <23-02-029@comp.compilers> <23-02-032@comp.compilers> <23-02-035@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="22332"; mail-complaints-to="abuse@iecc.com" Keywords: arithmetic, comment Posted-Date: 11 Feb 2023 15:20:25 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <23-02-035@comp.compilers> Xref: csiph.com comp.compilers:3380 (snip, I wrote) > But also, the 704 Fortran, and I believe still the 7090, > indexes arrays from the end of memory toward the beginning. And or moderator wrote: > [It did because for reasons I have never been able to figure out, > the 70x series subtracted rather than added the contents of > an index register to get the effective address. -John] I suppose so, but it was also convenient. Compilers (or linkers) generate code starting from the bottom of memory, and allocate variables starting from the top. (Different for different sized machines.) Since Fortran COMMON can be different length, or at least blank COMMON in later versions, allocating it from the end of memory works well. You can extend common from one subroutine to the next, or with chaining, to another whole program. So, was Fortran designed around the hardware, to allocate memory from the end? Or maybe just lucky. [Fortran was definitely designed around the 704. I have done a lot of looking to try and find out where the subtracted index registers came from, and while there are a lot of guesses, there is nothing written down. The three index registers were 1,2, and 4, and if you specified more than one, it OR'ed them together and subtracted the result, which was really strange. There were a lot of other machines with index registers but none I know of that subtracted or OR'ed. I have also been unable to tell whether the OR'ing was deliberate or just a result of minimizing the number of tubes that they then documented. It was likely useless since the 7094 had 7 index registers and a flag in case you wanted the old behavior. -John]