# Re: C arithmetic, was Software proofs, was Are there different

## gah4 <gah4@u.washington.edu>

Sat, 11 Feb 2023 00:01:33 -0800 (PST)

*From comp.compilers*

Related articles |

[4 earlier articles] |

Re: C arithmetic, was Software proofs, was Are there different *anton@mips.complang.tuwien.ac.at* (2023-02-08) |

Re: C arithmetic, was Software proofs, was Are there different *DrDiettrich1@netscape.net (Hans-Peter Diettrich)* (2023-02-08) |

Re: C arithmetic, was Software proofs, was Are there different *gah4@u.washington.edu (gah4)* (2023-02-09) |

Re: C arithmetic, was Software proofs, was Are there different *gah4@u.washington.edu (gah4)* (2023-02-09) |

Re: C arithmetic, was Software proofs, was Are there different *DrDiettrich1@netscape.net (Hans-Peter Diettrich)* (2023-02-10) |

Re: C arithmetic, was Software proofs, was Are there different *gah4@u.washington.edu (gah4)* (2023-02-10) |

**Re: C arithmetic, was Software proofs, was Are there different ***gah4@u.washington.edu (gah4)* (2023-02-11) |

Re: C arithmetic, was Software proofs, was Are there different *anton@mips.complang.tuwien.ac.at* (2023-02-11) |

Re: C arithmetic, was Software proofs, was Are there different *drb@ihatespam.msu.edu* (2023-02-12) |

| List of all articles for this month |

**From: ** | gah4 <gah4@u.washington.edu> |

**Newsgroups: ** | comp.compilers |

**Date: ** | Sat, 11 Feb 2023 00:01:33 -0800 (PST) |

**Organization: ** | Compilers Central |

**References: ** | 23-01-092 23-02-003 23-02-019 23-02-025 23-02-026 23-02-029 23-02-032 23-02-035 |

**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 |

**In-Reply-To: ** | 23-02-035 |

(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]

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.