From: rudra on
Dear friends,
I have a old package in f77. I am using some feature of this in my own
code. I am "make"ing the full package of the old one, but not using
all of them. I can not, by hand check which subroutirens/functions/
entries are actually called and which are not called but compiled.
Is there any way to check or list this?
I am using ifort and gfortran in linux machine.
From: Dr Ivan D. Reid on
On Wed, 4 Aug 2010 06:21:41 -0700 (PDT), rudra <bnrj.rudra(a)gmail.com>
wrote in <f4aa4f4d-6704-4d3e-b312-0ccd91d6f25a(a)x24g2000pro.googlegroups.com>:
> Dear friends,
> I have a old package in f77. I am using some feature of this in my own
> code. I am "make"ing the full package of the old one, but not using
> all of them. I can not, by hand check which subroutirens/functions/
> entries are actually called and which are not called but compiled.
> Is there any way to check or list this?
> I am using ifort and gfortran in linux machine.

man gprof

--
Ivan Reid, School of Engineering & Design, _____________ CMS Collaboration,
Brunel University. Ivan.Reid@[brunel.ac.uk|cern.ch] Room 40-1-B12, CERN
KotPT -- "for stupidity above and beyond the call of duty".
From: rudra on
Thanks.
I man it and made the list.
From: user1 on
rudra wrote:
> Dear friends,
> I have a old package in f77. I am using some feature of this in my own
> code. I am "make"ing the full package of the old one, but not using
> all of them. I can not, by hand check which subroutirens/functions/
> entries are actually called and which are not called but compiled.
> Is there any way to check or list this?
> I am using ifort and gfortran in linux machine.


ftnchek -calltree <myprog.f


From: mecej4 on
rudra wrote:

> Dear friends,
> I have a old package in f77. I am using some feature of this in my own
> code. I am "make"ing the full package of the old one, but not using
> all of them. I can not, by hand check which subroutirens/functions/
> entries are actually called and which are not called but compiled.
> Is there any way to check or list this?
> I am using ifort and gfortran in linux machine.

There is another aspect which you have not stated but has a bearing on the
question. If you link your code against an old package of subroutines and
functions, there are three classes of functions and subroutines:

(i) Those that exist in the package but, had they been absent, would not
have caused any "missing externals" errors at link time.

(ii) Routines in the package that are needed to satisfy needed externals,
but are not reached during a particular execution run. These may vary from
run to run.

(iii) Routines in the package that are used to satisfy externals _and_
reached during execution.

See the example below. Because i is assigned the value 3, SUBB is never used
during the run, but is needed to satisfy the linker. If you use the
suggested GPROF run, it will show you only SUBA, i.e., routines in group
(iii) above.

If you want the list of routines in (ii), give the compiler/linker only your
code, take the list of unsatisfied externals that the linker emits, sort,
undecorate/demangle names, and remove duplicates. Watch out for "smart"
compilers that recognize that the "call subb()" statement can be skipped.
Some linkers leave out "dead code": unneeded symbols and objects.

-- mecej4

__________________________
!-- User code
program tst
integer i
i=3
if(mod(i,2).eq.1)then
call suba()
else
call subb()
endif
end program tst
!
!-- package routines below
!
subroutine suba()
write(*,*)' suba'
return
end subroutine suba

subroutine subb()
write(*,*)' subb'
return
end subroutine subb

subroutine subc()
write(*,*)' subc'
return
end subroutine subc
____________________________