Van Snyder wrote:
> If GO TO could only go to a COME FROM, GO TO statements were labelled,
> the label of the GO TO had to be mentioned in the label of the COME FROM,
> and every label in a COME FROM was the label of a GO TO that mentioned
> the COME FROM, one could reverse the control flow graph by inspection
> (as opposed to "by grep" plus a lot of rejecting accidental similarities).
>
> But, this will never happen in Fortran.
Maybe, but it can happen in F. As you may remember reading,
the next versions of F will allow GOTO, but only to a CONTINUE
statement, so this satisfies the first requirement above (well,
COME FROM is spelled CONTINUE).
Given this restriction, it should be fairly easy to generate
the "COME FROM" info for each CONTINUE statement and I am
willing to do this, if anybody else thinks this would be useful.
We would also need to allow GOTOs to be labeled, but this is
trivial.
Question: what do we do with the information? Create a
separate file of info, kinda like an old "cross reference"?
Insert it as comments into a revised source file? ???
Another alternative (obviously this is being generated quickly 8^):
require the programmer to append a comment to each CONTINUE
statement of the form !FFF$ 64, 397, 245 listing all
GOTOs that come to it (remember we are taking about F, not Fortran).
I think this is essentially one of Van's requirements above.
I like another option to this tool: if the GOTO is backward,
you lose a week's allowance (maybe issue a warning, or don't
allow it???).
Hey, I always thought the COME FROM statement should prove useful!
--
Walt Brainerd [log in to unmask]
Unicomp, Inc. +1-520-298-7212 298-7074 (fax)
7660 E. Broadway, Suite 308 888-330-6060
Tucson, AZ 85710 USA http://www.uni-comp.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|