Re: call tree

Dick Hendrickson <dick.hendrickson@xxxxxxx> wrote:

I think it's impossible to do any kind of static source code tree
generation for any large program written in modern Fortran .

There are many large old Fortran programs that one might want
to work on. (Maybe only make small changes, though.)

When you first start working with a large program, nothing
looks familiar. A printed tree (or graph) is helpful as you
get to know the program. Many old large programs have a fairly
small tree, if the subroutines are large. Also, with the
Fortran 66 limit of six characters for names, they are often less
descriptive than you would like.

The only hope is to trap the subroutine entry code and build
a dynamic tree. My 4 reasons for saying this are:

1) With polymorphic variables and type bound procedures the
name of a called routine isn't available until run-time.

Probably still rare, but maybe not for long.

2) The rules for generic routine resolution are so intricate
that nobody will be able to write a stand-alone thing to
untangle them. However, since they are compile time resolvable,
you could recover them from some sort of compiler symbolic

I would expect much of the generic routines to be leaf routines
(that don't call much else, though likely some system intrinsics).

3) FORTRAN has allowed routines to be passed in as arguments and
then invoked via the dummy argument name since at least F77.
The same source code "name" can refer to different routines at
run time.

I believe back to Fortran II, it is, at least, in Fortran 66.
Usually only used once, or at least a small number of times,
even in large programs. If you link to the call using the
name, then one knows where to look.

4) Fortran's procedure pointers are similar to 1) and 3).


-- glen

Relevant Pages

  • Re: Python advocacy in scientific computation
    ... Very few subroutines (Maybe some LINPAC or some other code package), lots of the dreaded GOTO statements. ... Still, as one post said, they teach us 8 semesters of mathematics and one of Fortran, expecting us to learn how to program by ourselves. ... add invocations to stub routines for each of those. ... I had to explain the history of the punch card. ...
  • Re: Sockets in gfortran?
    ... someone seen or developed Fortran code to handle sockets via C? ... The read/write/close routines are used in both clients and servers ... char *host_name; ... int host_name_len; ...
  • Re: Passing shell arguments to Fortran programs the Linux way
    ... document along with an explanation as to why such command lines cannot ... have a C mainprogram, calling a Fortran ... the need to define a CLD and use the CLI$ routines is incorrect. ... Lawson's f2kcli web page is in my view pretty much the ...
  • Re: most widely used language for numerical programming?
    ... The matrix multiplication routines and other built in array processing ... Additionally, the compiler can optimize such codes much, much more than it can ... Pappys Fortran is still compilable with todays newer compilers as ... People seem to like languages that try to do too much. ...
  • Re: F.03 C Interoperability doubt. Argument types
    ... from the net) that i need to call from my fortran subroutine written ... Since the Fortran and C routines have different names, ... Fortran array, except the subscripts will be in the opposite ...