GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 1.1

Historical FORTRAN storage and recursion

Compiler Design · Runtime Environments & Parameter Passing · Full GATE CSE 1994 paper

GATE 1994, Q1.1 MCQ
Report issue

Runtime Environments & Parameter Passing

Question 1.1, GATE 1994: Why did the historical FORTRAN implementations described not permit recursion: static allocation, dynamic allocation, absent hardware stacks, or impossibility on some machines?
Tap to enlarge
Your answer
Answer & solution

Answer: A: static allocation in the historical implementation model (no official key was published)

A single statically allocated location for each local variable provides only one activation’s storage. A recursive call would overwrite values still needed by its caller, so that implementation cannot support general recursion without changing its storage scheme. A stack of activation records is the usual solution; a hardware stack is not essential because software can implement one. Thus A explains the historical restriction. It is not a claim about all modern Fortran: later standards and implementations support recursive procedures with appropriate activation storage.

Original paper, page 1